From: Chengming Zhou <chengming.zhou@linux.dev>
To: linke li <lilinke99@qq.com>
Cc: 42.hyeyoo@gmail.com, akpm@linux-foundation.org, cl@linux.com,
iamjoonsoo.kim@lge.com, linux-kernel@vger.kernel.org,
linux-mm@kvack.org, penberg@kernel.org, rientjes@google.com,
roman.gushchin@linux.dev, vbabka@suse.cz
Subject: Re: [PATCH] mm/slub: mark racy accesses on slab->slabs
Date: Thu, 21 Mar 2024 11:12:20 +0800 [thread overview]
Message-ID: <62b4dd34-bf05-4da6-94ea-cb85ac48bbeb@linux.dev> (raw)
In-Reply-To: <tencent_BF745A1543ABB0579DFC20480AA1A4456307@qq.com>
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
>
prev parent reply other threads:[~2024-03-21 3:12 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-09 7:48 [PATCH] mm/slub: mark racy accesses on slab->slabs linke li
2024-03-09 11:24 ` Chengming Zhou
2024-03-21 2:48 ` linke li
2024-03-21 3:12 ` Chengming Zhou [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=62b4dd34-bf05-4da6-94ea-cb85ac48bbeb@linux.dev \
--to=chengming.zhou@linux.dev \
--cc=42.hyeyoo@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=cl@linux.com \
--cc=iamjoonsoo.kim@lge.com \
--cc=lilinke99@qq.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=penberg@kernel.org \
--cc=rientjes@google.com \
--cc=roman.gushchin@linux.dev \
--cc=vbabka@suse.cz \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).