Harry wrote: > Teach kfree_rcu_sheaf() how to handle the !allow_spin case. Try to get > an empty sheaf from pcs->spare or the barn even when spinning is not > allowed. Unlike __pcs_replace_full_main(), try harder to allocate > an empty sheaf because the fallback path will be more expensive than > kfree_nolock(). > > Now that slab has internal alloc_flags to describe context, introduce > free_flags analogously and convert free_flags to alloc_flags when > allocating memory in the free path. > > When trylock fails or the kernel observes non-NULL pcs->rcu_free after > lock acquisition, free the sheaf instead of putting it to the barn. > This is rare and not worth complicating the code. > > Since call_rcu() cannot be called in an unknown context, > kfree_rcu_sheaf() fails when the rcu sheaf becomes full. > > Link: > https://lore.kernel.org/linux-mm/[email protected] > Reviewed-by: Vlastimil Babka (SUSE) <[email protected]> > Signed-off-by: Harry Yoo (Oracle) <[email protected]>
LGTM! Reviewed-by: Shengming Hu <[email protected]> -- With Best Regards, Shengming

