From: Hugh Dickins <hughd@google.com>
To: Davidlohr Bueso <dave@stgolabs.net>
Cc: Hugh Dickins <hughd@google.com>, Davidlohr Bueso <dbueso@suse.de>,
Mel Gorman <mgorman@techsingularity.net>,
Peter Zijlstra <peterz@infradead.org>,
Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@kernel.org>,
Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
Chris Mason <clm@fb.com>, Darren Hart <dvhart@linux.intel.com>,
linux-kernel@vger.kernel.org, Mel Gorman <mgorman@suse.de>
Subject: Re: [PATCH v4] futex: Remove requirement for lock_page in get_futex_key
Date: Fri, 29 Jan 2016 10:46:22 -0800 (PST) [thread overview]
Message-ID: <alpine.LSU.2.11.1601291043030.4784@eggly.anvils> (raw)
In-Reply-To: <20160129183557.GA16147@linux-uzut.site>
On Fri, 29 Jan 2016, Davidlohr Bueso wrote:
> On Wed, 27 Jan 2016, Hugh Dickins wrote:
>
> > > + *
> > > + * The RCU read lock is taken as the inode is finally freed
> > > + * under RCU. If the mapping still matches expectations then
> > > the
> > > + * mapping->host can be safely accessed as being a valid
> > > inode.
> > > + */
> > > + rcu_read_lock();
> > > + if (READ_ONCE(page->mapping) != mapping ||
> > > + !mapping->host) {
> >
> > If you're being as paranoid as all the WARN_ON_ONCEs hereabouts imply,
> > then it would be better to do the inode = READ_ONCE(mapping->host)
> > before checking !inode rather than !mapping->host.
>
> Ok, it also reads a bit nicer than the above, which was simply avoiding
> a load in the again case.
>
> rcu_read_lock();
> inode = READ_ONCE(mapping->host);
Just a quick unthinking from-the-hip response to that, something
for you to think over before sending v5: without looking back
at the code, it's not obvious to me that it's safe to read
mapping->host before we've confirmed under rcu_read_lock()
that page->mapping still matches mapping.
>
> if (!inode || READ_ONCE(page->mapping) != mapping)
> rcu_read_unlock();
> put_page(page);
>
> goto again;
> }
prev parent reply other threads:[~2016-01-29 18:46 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-23 17:14 Davidlohr Bueso
2016-01-27 20:10 ` Thomas Gleixner
2016-01-28 3:02 ` Hugh Dickins
2016-01-29 18:35 ` Davidlohr Bueso
2016-01-29 18:46 ` Hugh Dickins [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=alpine.LSU.2.11.1601291043030.4784@eggly.anvils \
--to=hughd@google.com \
--cc=bigeasy@linutronix.de \
--cc=clm@fb.com \
--cc=dave@stgolabs.net \
--cc=dbueso@suse.de \
--cc=dvhart@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mgorman@suse.de \
--cc=mgorman@techsingularity.net \
--cc=mingo@kernel.org \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
/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
all inboxes | Powered by JetHome®