[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <62b4dd34-bf05-4da6-94ea-cb85ac48bbeb@linux.dev>
Date: Thu, 21 Mar 2024 11:12:20 +0800
From: Chengming Zhou <chengming.zhou@...ux.dev>
To: linke li <lilinke99@...com>
Cc: 42.hyeyoo@...il.com, akpm@...ux-foundation.org, cl@...ux.com,
iamjoonsoo.kim@....com, linux-kernel@...r.kernel.org, linux-mm@...ck.org,
penberg@...nel.org, rientjes@...gle.com, roman.gushchin@...ux.dev,
vbabka@...e.cz
Subject: Re: [PATCH] mm/slub: mark racy accesses on slab->slabs
On 2024/3/21 10:48, linke li wrote:
> Sorry for a late reply, I just found this because of my bad email client.
>
>> There is another unmarked access of "slab->slabs" in the show_slab_objects(),
>> which you can change too.
>
> Yes, I think show_slab_objects() has a similar situation. Should I
> consider to submit a V2 patch for this?
Yes, I think so.
>
>> I'm not sure that it's really safe to access "slab->slabs" here without any protection?
>> Although it should be no problem in practice, alternative choice maybe putting partial
>> slabs count in the kmem_cache_cpu struct.
>
> I think it is ok, because it seems that slab->slabs in slub_percpu_partial
> and show_slab_objects() are just used for showing some infomation.
>
> I noticed Paul summarized some of these strategies in access-marking.txt[1]
Ok, thanks.
>
> Quote from it:
>
> "Use of the data_race() Macro
> ----------------------------
>
> Here are some situations where data_race() should be used instead of
> READ_ONCE() and WRITE_ONCE():
>
> 1. Data-racy loads from shared variables whose values are used only
> for diagnostic purposes.
>
> 2. Data-racy reads whose values are checked against marked reload.
>
> 3. Reads whose values feed into error-tolerant heuristics.
>
> 4. Writes setting values that feed into error-tolerant heuristics.
> "
>
> Thanks,
> Linke
>
> [1]https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/tools/memory-model/Documentation/access-marking.txt
>
Powered by blists - more mailing lists