• Jason Gunthorpe's avatar
    RDMA/mlx5: Use an xarray for the children of an implicit ODP · 423f52d6
    Jason Gunthorpe authored
    Currently the child leaves are stored in the shared interval tree and
    every lookup for a child must be done under the interval tree rwsem.
    
    This is further complicated by dropping the rwsem during iteration (ie the
    odp_lookup(), odp_next() pattern), which requires a very tricky an
    difficult to understand locking scheme with SRCU.
    
    Instead reserve the interval tree for the exclusive use of the mmu
    notifier related code in umem_odp.c and give each implicit MR a xarray
    containing all the child MRs.
    
    Since the size of each child is 1GB of VA, a 1 level xarray will index 64G
    of VA, and a 2 level will index 2TB, making xarray a much better
    data structure choice than an interval tree.
    
    The locking properties of xarray will be used in the next patches to
    rework the implicit ODP locking scheme into something simpler.
    
    At this point, the xarray is locked by the implicit MR's umem_mutex, and
    read can also be locked by the odp_srcu.
    
    Link: https://lore.kernel.org/r/20191009160934.3143-10-jgg@ziepe.caReviewed-by: default avatarArtemy Kovalyov <artemyko@mellanox.com>
    Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
    423f52d6
odp.c 45.5 KB