Skip to content
  • Mitko Haralanov's avatar
    staging/rdma/hfi1: Improve performance of TID cache look up · a92ba6d6
    Mitko Haralanov authored
    
    
    When TID caching was enabled, the way the driver found
    RB nodes when PSM was unprogramming TID entries was by
    traversing the RB tree, looking for a match on the
    RcvArray entry index.
    
    The performance of this algorithm was not only poor but
    also inconsistent depending on how many RB nodes would
    have to be traversed before a match was found.
    
    The lower performance was especially evident in cases where
    there was a cache miss with the cache full, requiring the
    unprogramming of several TID entries.
    
    This commit changes how RB nodes are looked up when being
    free'd by PSM to a index-based lookup into a flat array on
    the index of the RcvArray entry. This turns the entire
    look-up process into an O(1) algorithm.
    
    Special care needs to be taken for situations when TID
    caching is disabled. In those cases, there is no need to
    insert the RB nodes into an actual RB tree. Since the entire
    RcvArray management mechanism is managed by an index-based
    algorithm, the RB nodes can be saved into the flat array,
    making both "insertion" and "removal" faster.
    
    Reviewed-by: default avatarArthur Kepner <arthur.kepner@intel.com>
    Reviewed-by: default avatarDennis Dalessandro <dennis.dalessandro@intel.com>
    Signed-off-by: default avatarMitko Haralanov <mitko.haralanov@intel.com>
    Signed-off-by: default avatarJubin John <jubin.john@intel.com>
    Signed-off-by: default avatarDoug Ledford <dledford@redhat.com>
    a92ba6d6