linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Miaohe Lin <linmiaohe@huawei.com>
To: Qian Cai <quic_qiancai@quicinc.com>
Cc: <akpm@linux-foundation.org>, <david@redhat.com>,
	<ying.huang@intel.com>, <songmuchun@bytedance.com>,
	<linux-mm@kvack.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v3 1/2] mm/swapfile: fix possible data races of inuse_pages
Date: Mon, 27 Jun 2022 21:27:43 +0800	[thread overview]
Message-ID: <fe3c4834-71a6-7867-2108-eca43fde62fc@huawei.com> (raw)
In-Reply-To: <Yrml4mB3sa5fZVJa@qian>

On 2022/6/27 20:43, Qian Cai wrote:
> On Sat, Jun 25, 2022 at 05:33:45PM +0800, Miaohe Lin wrote:
>> si->inuse_pages could still be accessed concurrently now. The plain reads
>> outside si->lock critical section, i.e. swap_show and si_swapinfo, which
>> results in data races. READ_ONCE and WRITE_ONCE is used to fix such data
>> races. Note these data races should be ok because they're just used for
>> showing swap info.
> 
> Was this found by kcsan? If so, it would be useful to record the exact
> kscan report in the commit message.

Sorry, it's found via code inspection.

Thanks.

> .
> 



  reply	other threads:[~2022-06-27 13:28 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-25  9:33 [PATCH v3 0/2] A few cleanup and fixup patches for swap Miaohe Lin
2022-06-25  9:33 ` [PATCH v3 1/2] mm/swapfile: fix possible data races of inuse_pages Miaohe Lin
2022-06-27  1:29   ` Huang, Ying
2022-06-27 12:43   ` Qian Cai
2022-06-27 13:27     ` Miaohe Lin [this message]
2022-06-27 13:47       ` Qian Cai
2022-06-28  1:56         ` Huang, Ying
2022-06-25  9:33 ` [PATCH v3 2/2] mm/swap: remove swap_cache_info statistics 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=fe3c4834-71a6-7867-2108-eca43fde62fc@huawei.com \
    --to=linmiaohe@huawei.com \
    --cc=akpm@linux-foundation.org \
    --cc=david@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=quic_qiancai@quicinc.com \
    --cc=songmuchun@bytedance.com \
    --cc=ying.huang@intel.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