All of lore.kernel.org
 help / color / mirror / Atom feed
From: Qian Cai <quic_qiancai@quicinc.com>
To: Miaohe Lin <linmiaohe@huawei.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 09:47:16 -0400	[thread overview]
Message-ID: <Yrm05NQs5+tCZawR@qian> (raw)
In-Reply-To: <fe3c4834-71a6-7867-2108-eca43fde62fc@huawei.com>

On Mon, Jun 27, 2022 at 09:27:43PM +0800, Miaohe Lin wrote:
> 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.

Well, if we are going to do a WRITE_ONCE() in those places just for
documentation purpose now, I think we will need to fix all places in the mm
subsystem to be consistent.

  reply	other threads:[~2022-06-27 13:48 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
2022-06-27 13:47       ` Qian Cai [this message]
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=Yrm05NQs5+tCZawR@qian \
    --to=quic_qiancai@quicinc.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=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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.