All of lore.kernel.org
 help / color / mirror / Atom feed
From: Qian Cai <cai@lca.pw>
To: John Hubbard <jhubbard@nvidia.com>
Cc: Marco Elver <elver@google.com>, Jan Kara <jack@suse.cz>,
	David Hildenbrand <david@redhat.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	ira.weiny@intel.com, Dan Williams <dan.j.williams@intel.com>,
	Linux Memory Management List <linux-mm@kvack.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	"Paul E. McKenney" <paulmck@kernel.org>
Subject: Re: [PATCH] mm: fix a data race in put_page()
Date: Sat, 8 Feb 2020 22:10:09 -0500	[thread overview]
Message-ID: <8602A57D-B420-489C-89CC-23D096014C47@lca.pw> (raw)
In-Reply-To: <5402183a-2372-b442-84d3-c28fb59fa7af@nvidia.com>



> On Feb 8, 2020, at 8:44 PM, John Hubbard <jhubbard@nvidia.com> wrote:
> 
> So it looks like we're probably stuck with having to annotate the code. Given
> that, there is a balance between how many macros, and how much commenting. For
> example, if there is a single macro (data_race, for example), then we'll need to
> add comments for the various cases, explaining which data_race situation is 
> happening.

On the other hand, it is perfect fine of not commenting on each data_race() that most of times, people could run git blame to learn more details. Actually, no maintainers from various of subsystems asked for commenting so far.

> 
> That's still true, but to a lesser extent if more macros are added. In this case,
> I suspect that READ_BITS() makes the commenting easier and shorter. So I'd tentatively
> lead towards adding it, but what do others on the list think?

Even read bits could be dangerous from data races and confusing at best, so I am not really sure what the value of introducing this new macro. People who like to understand it correctly still need to read the commit logs.

This flags->zonenum is such a special case that I don’t really see it regularly for the last few weeks digging KCSAN reports, so even if it is worth adding READ_BITS(), there are more equally important macros need to be added together to be useful initially. For example, HARMLESS_COUNTERS(), READ_SINGLE_BIT(), READ_IMMUTATABLE_BITS() etc which Linus said exactly wanted to avoid.

  reply	other threads:[~2020-02-09  3:10 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-06 13:17 [PATCH] mm: fix a data race in put_page() Qian Cai
2020-02-06 13:33 ` David Hildenbrand
2020-02-06 13:51   ` Qian Cai
2020-02-06 13:51     ` Qian Cai
2020-02-06 14:55   ` Jan Kara
2020-02-06 14:59     ` David Hildenbrand
2020-02-06 15:23     ` Qian Cai
2020-02-06 23:34       ` John Hubbard
2020-02-06 23:36         ` John Hubbard
2020-02-06 23:55         ` Qian Cai
2020-02-07  0:18         ` Qian Cai
2020-02-07  0:27           ` John Hubbard
2020-02-07  0:55             ` Qian Cai
2020-02-07 13:17               ` Marco Elver
2020-02-07 13:17                 ` Marco Elver
2020-02-09  1:44                 ` John Hubbard
2020-02-09  3:10                   ` Qian Cai [this message]
2020-02-09  7:12                     ` John Hubbard
2020-02-10  7:48                       ` Marco Elver
2020-02-10  7:48                         ` Marco Elver
2020-02-10 12:16                         ` Qian Cai
2020-02-10 12:58                           ` Marco Elver
2020-02-10 12:58                             ` Marco Elver
2020-02-10 13:36                             ` Qian Cai
2020-02-10 13:38                               ` Marco Elver
2020-02-10 13:38                                 ` Marco Elver
2020-02-10 13:55                                 ` Qian Cai
2020-02-10 14:12                                   ` Marco Elver
2020-02-10 14:12                                     ` Marco Elver
2020-02-10 14:31                                     ` Qian Cai
2020-02-10 16:23                         ` Qian Cai
2020-02-10 16:23                           ` Qian Cai
2020-02-10 16:33                           ` Marco Elver
2020-02-10 16:33                             ` Marco Elver

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=8602A57D-B420-489C-89CC-23D096014C47@lca.pw \
    --to=cai@lca.pw \
    --cc=akpm@linux-foundation.org \
    --cc=dan.j.williams@intel.com \
    --cc=david@redhat.com \
    --cc=elver@google.com \
    --cc=ira.weiny@intel.com \
    --cc=jack@suse.cz \
    --cc=jhubbard@nvidia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=paulmck@kernel.org \
    /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.