Re: [PATCH v3 21/21] mm/slub: cleanup and repurpose some stat items

Vlastimil Babka
2026-01-22T09:30:47Z

On 1/22/26 06:52, Hao Li wrote:
> On Fri, Jan 16, 2026 at 03:40:41PM +0100, Vlastimil Babka wrote:
>> A number of stat items related to cpu slabs became unused, remove them.
>>
>> Two of those were ALLOC_FASTPATH and FREE_FASTPATH. But instead of
>> removing those, use them instead of ALLOC_PCS and FREE_PCS, since
>> sheaves are the new (and only) fastpaths, Remove the recently added
>> _PCS variants instead.
>>
>> Change where FREE_SLOWPATH is counted so that it only counts freeing of
>> objects by slab users that (for whatever reason) do not go to a percpu
>> sheaf, and not all (including internal) callers of __slab_free(). Thus
>> flushing sheaves (counted by SHEAF_FLUSH) no longer also increments
>> FREE_SLOWPATH. This matches how ALLOC_SLOWPATH doesn't count sheaf
>> refills (counted by SHEAF_REFILL).
>>
>> Reviewed-by: Suren Baghdasaryan <surenb@google.com>
>> Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
>> ---
>> mm/slub.c | 77 +++++++++++++++++----------------------------------------------
>> 1 file changed, 21 insertions(+), 56 deletions(-)
>>
>> diff --git a/mm/slub.c b/mm/slub.c
>> index c12e90cb2fca..d73ad44fa046 100644
>> --- a/mm/slub.c
>> +++ b/mm/slub.c
>> @@ -330,33 +330,19 @@ enum add_mode {
>> };
>>
>> enum stat_item {
>> - ALLOC_PCS, /* Allocation from percpu sheaf */
>> - ALLOC_FASTPATH, /* Allocation from cpu slab */
>> - ALLOC_SLOWPATH, /* Allocation by getting a new cpu slab */
>> - FREE_PCS, /* Free to percpu sheaf */
>> + ALLOC_FASTPATH, /* Allocation from percpu sheaves */
>> + ALLOC_SLOWPATH, /* Allocation from partial or new slab */
>> FREE_RCU_SHEAF, /* Free to rcu_free sheaf */
>> FREE_RCU_SHEAF_FAIL, /* Failed to free to a rcu_free sheaf */
>> - FREE_FASTPATH, /* Free to cpu slab */
>> - FREE_SLOWPATH, /* Freeing not to cpu slab */
>> + FREE_FASTPATH, /* Free to percpu sheaves */
>> + FREE_SLOWPATH, /* Free to a slab */
>
> Nits: Would it make sense to add stat(s, FREE_SLOWPATH) in
> free_deferred_objects() as well, since it also calls __slab_free()?

Yeah.

> Everything else looks good.
>
> This patchset replaces cpu slab with cpu sheaves and really simplifies the code
> overall - I really like the direction and the end result. It's really been a
> pleasure reviewing this series. Thanks!
>
> Reviewed-by: Hao Li <hao.li@linux.dev>

Thanks a lot for the thorough review!