• Matthew Wilcox's avatar
    XArray: Add support for 1s-based allocation · 3ccaf57a
    Matthew Wilcox authored
    A lot of places want to allocate IDs starting at 1 instead of 0.
    While the xa_alloc() API supports this, it's not very efficient if lots
    of IDs are allocated, due to having to walk down to the bottom of the
    tree to see if ID 1 is available, then all the way over to the next
    non-allocated ID.  This method marks ID 0 as being occupied which wastes
    one slot in the XArray, but preserves xa_empty() as working.
    Signed-off-by: default avatarMatthew Wilcox <willy@infradead.org>
    3ccaf57a
xarray.rst 20.9 KB