lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Mon, 26 Feb 2024 09:38:17 -0800 (PST)
From: "Christoph Lameter (Ampere)" <cl@...ux.com>
To: Vlastimil Babka <vbabka@...e.cz>
cc: Chengming Zhou <chengming.zhou@...ux.dev>, 
    David Rientjes <rientjes@...gle.com>, 
    Jianfeng Wang <jianfeng.w.wang@...cle.com>, penberg@...nel.org, 
    iamjoonsoo.kim@....com, akpm@...ux-foundation.org, 
    roman.gushchin@...ux.dev, 42.hyeyoo@...il.com, linux-mm@...ck.org, 
    linux-kernel@...r.kernel.org, Chengming Zhou <zhouchengming@...edance.com>
Subject: Re: [PATCH] slub: avoid scanning all partial slabs in
 get_slabinfo()

On Fri, 23 Feb 2024, Vlastimil Babka wrote:

> 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).

We could mark the state change (list ownership) in the slab metadata and 
then abort the scan if the state mismatches the list.

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

This could get tricky but we already do similar things with RCU slabs 
objects/metadata where we allow the resuse of the object before the RCU 
period expires and there is an understanding that the user of those 
objects need to verify the type of object matching expectations when 
looking for objects.


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ