Re: [PATCH v5 2/8] mm/slab: handle the !allow_spin case in kfree_rcu_sheaf()
<[email protected]> Thu, 30 Jul 2026 19:10:20 +0800 (CST)
| Newsgroups | dev.linux.lists.linux-rt-devel,org.kernel.vger.bpf,org.kernel.vger.linux-kernel,org.kernel.vger.rcu,org.kvack.linux-mm |
|---|---|
| Message-ID | <[email protected]> |
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