Re: [PATCH] slub: avoid scanning all partial slabs in get_slabinfo()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2/23/24 10:37, Chengming Zhou wrote:
> On 2024/2/23 17:24, Vlastimil Babka wrote:
>> 
>>>>
>>>
>>> I think this is a better direction! We can use RCU list if slab can be freed by RCU.
>> 
>> Often we remove slab from the partial list for other purposes than freeing -
>> i.e. to become a cpu (partial) slab, and that can't be handled by a rcu
>> callback nor can we wait a grace period in such situations.
> 
> IMHO, only free_slab() need to use call_rcu() to delay free the slab,
> other paths like taking partial slabs from node partial list don't need
> to wait for RCU grace period.
> 
> All we want is safely lockless iterate over the node partial list, right?

Yes, and for that there's the "list_head slab_list", which is in union with
"struct slab *next" and "int slabs" for the cpu partial list. So if we
remove a slab from the partial list and rewrite the list_head for the
partial list purposes, it will break the lockless iterators, right? We would
have to wait a grace period between unlinking the slab from partial list (so
no new iterators can reach it), and reusing the list_head (so we are sure
the existing iterators stopped looking at our slab).

Maybe there's more advanced rcu tricks but this is my basic understanding
how this works.

> Thanks.





[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux