From: "Huang, Ying" <ying.huang@intel.com>
To: Qian Cai <quic_qiancai@quicinc.com>, Miaohe Lin <linmiaohe@huawei.com>
Cc: Muchun Song <songmuchun@bytedance.com>,
<akpm@linux-foundation.org>, <david@redhat.com>,
<linux-mm@kvack.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2 2/3] mm/swapfile: fix possible data races of inuse_pages
Date: Tue, 21 Jun 2022 09:14:00 +0800 [thread overview]
Message-ID: <87pmj2q0mf.fsf@yhuang6-desk2.ccr.corp.intel.com> (raw)
In-Reply-To: <YrDob8+9Xgig6mZw@qian> (Qian Cai's message of "Mon, 20 Jun 2022 17:36:47 -0400")
Qian Cai <quic_qiancai@quicinc.com> writes:
> On Mon, Jun 20, 2022 at 10:20:07PM +0800, Muchun Song wrote:
>> The lock does not protect the read sides. So the write side should be
>> fixed by WRITTE_ONCE().
>
> https://lwn.net/Articles/816854/
>
> "Unmarked writes (aligned and up to word size) can be treated as if they had
> used WRITE_ONCE() by building with
> CONFIG_KCSAN_ASSUME_PLAIN_WRITES_ATOMIC=y (also selected by default).
> Experience has shown that compilers are much less likely to destructively
> optimize in-kernel writes than reads. Some developers might therefore
> choose to use READ_ONCE() but omit the corresponding WRITE_ONCE(). Other
> developers might prefer the documentation benefits and long-term peace of
> mind accruing from explicit use of WRITE_ONCE()..."
Thanks for pointing me to this great article. So although not required
by KCSAN strictly, WRITE_ONCE() is still good for documentation, etc.
Just like we have done for swap_info_struct->highest_bit, etc.
Best Regards,
Huang, Ying
next prev parent reply other threads:[~2022-06-21 1:14 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-08 14:40 [PATCH v2 0/3] A few cleanup and fixup patches for swap Miaohe Lin
2022-06-08 14:40 ` [PATCH v2 1/3] mm/swapfile: make security_vm_enough_memory_mm() work as expected Miaohe Lin
2022-06-17 7:33 ` David Hildenbrand
2022-06-18 2:43 ` Miaohe Lin
2022-06-18 7:10 ` David Hildenbrand
2022-06-18 7:31 ` Miaohe Lin
2022-06-20 7:31 ` Huang, Ying
2022-06-20 12:12 ` Miaohe Lin
2022-06-21 1:35 ` Huang, Ying
2022-06-21 7:37 ` Miaohe Lin
2022-06-21 7:42 ` Huang, Ying
2022-06-21 8:20 ` Miaohe Lin
2022-06-08 14:40 ` [PATCH v2 2/3] mm/swapfile: fix possible data races of inuse_pages Miaohe Lin
2022-06-20 7:54 ` Huang, Ying
2022-06-20 9:04 ` Miaohe Lin
2022-06-20 9:23 ` Muchun Song
2022-06-20 12:23 ` Miaohe Lin
2022-06-20 12:32 ` Miaohe Lin
2022-06-20 13:46 ` Qian Cai
2022-06-20 14:20 ` Muchun Song
2022-06-20 21:36 ` Qian Cai
2022-06-21 1:14 ` Huang, Ying [this message]
2022-06-21 3:39 ` Muchun Song
2022-06-21 6:40 ` Miaohe Lin
2022-06-08 14:40 ` [PATCH v2 3/3] mm/swap: remove swap_cache_info statistics Miaohe Lin
2022-06-08 15:16 ` David Hildenbrand
2022-06-20 8:08 ` Huang, Ying
2022-06-20 9:05 ` Miaohe Lin
2022-06-20 9:30 ` Muchun Song
2022-06-17 2:37 ` [PATCH v2 0/3] A few cleanup and fixup patches for swap Andrew Morton
2022-06-17 3:00 ` Miaohe Lin
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=87pmj2q0mf.fsf@yhuang6-desk2.ccr.corp.intel.com \
--to=ying.huang@intel.com \
--cc=akpm@linux-foundation.org \
--cc=david@redhat.com \
--cc=linmiaohe@huawei.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=quic_qiancai@quicinc.com \
--cc=songmuchun@bytedance.com \
/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