From: Hugh Dickins <hughd@google.com>
To: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
Cc: Peter Zijlstra <peterz@infradead.org>,
Linus Torvalds <torvalds@linux-foundation.org>,
Rik van Riel <riel@redhat.com>,
Andrew Morton <akpm@linux-foundation.org>,
Nick Piggin <npiggin@kernel.dk>,
Andrea Arcangeli <aarcange@redhat.com>,
linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org,
linux-mm@kvack.org
Subject: Re: [RFC] page-table walkers vs memory order
Date: Wed, 25 Jul 2012 13:26:43 -0700 (PDT) [thread overview]
Message-ID: <alpine.LSU.2.00.1207251313180.1942@eggly.anvils> (raw)
In-Reply-To: <20120725175628.GH2378@linux.vnet.ibm.com>
On Wed, 25 Jul 2012, Paul E. McKenney wrote:
> On Tue, Jul 24, 2012 at 02:51:05PM -0700, Hugh Dickins wrote:
> >
> > I'm totally unclear whether the kernel ever gets built with these
> > 'creative' compilers that you refer to. Is ACCESS_ONCE() a warning
> > of where some future compiler would be permitted to mess with our
> > assumptions? Or is it actually saving us already today? Would we
> > know? Could there be a boottime test that would tell us? Is it
> > likely that a future compiler would have an "--access_once"
> > option that the kernel build would want to turn on?
>
> The problem is that, unless you tell it otherwise, the compiler is
> permitted to assume that the code that it is generating is the only thing
> active in that address space at that time. So the compiler might know
> that it already has a perfectly good copy of that value somewhere in
> its registers, or it might decide to fetch the value twice rather than
> once due to register pressure, either of which can be fatal in SMP code.
> And then there are more aggressive optimizations as well.
>
> ACCESS_ONCE() is a way of telling the compiler to access the value
> once, regardless of what cute single-threaded optimizations that it
> otherwise might want to apply.
Right, but you say "might": I have never heard it asserted, that we do
build the kernel with a compiler which actually makes such optimizations.
There's a lot of other surprising things which a compiler is permitted
to do, but we would simply not use such a compiler to build the kernel.
Does some version of gcc, under the options which we insist upon,
make such optimizations on any of the architectures which we support?
Or is there some other compiler in use on the kernel, which makes
such optimizations? It seems a long time since I heard of building
the kernel with icc. clang?
I don't mind the answer "Yes, you idiot" - preferably with an example
or two of which compiler and which piece of code it has bitten us on.
I don't mind the answer "We just don't know" if that's the case.
But I'd like a better idea of how much to worry: is ACCESS_ONCE
demonstrably needed today, or rather future-proofing and documentation?
Thanks,
Hugh
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2012-07-25 20:27 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-23 17:34 Peter Zijlstra
2012-07-23 19:27 ` Paul E. McKenney
2012-07-24 21:51 ` Hugh Dickins
2012-07-25 17:56 ` Paul E. McKenney
2012-07-25 20:26 ` Hugh Dickins [this message]
2012-07-25 21:12 ` Paul E. McKenney
2012-07-25 22:09 ` Hugh Dickins
2012-07-25 22:37 ` Paul E. McKenney
2012-07-26 8:11 ` Peter Zijlstra
2012-07-30 19:21 ` Jamie Lokier
2012-07-30 20:28 ` Paul E. McKenney
2012-07-26 20:39 ` Peter Zijlstra
2012-07-27 19:22 ` Hugh Dickins
2012-07-27 19:39 ` Paul E. McKenney
2012-08-04 14:37 ` Andrea Arcangeli
2012-08-04 22:02 ` Paul E. McKenney
2012-08-04 22:47 ` Andrea Arcangeli
2012-08-04 22:59 ` Dr. David Alan Gilbert
2012-08-04 23:11 ` Paul E. McKenney
2012-08-05 0:10 ` Dr. David Alan Gilbert
2012-08-04 23:06 ` Paul E. McKenney
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.00.1207251313180.1942@eggly.anvils \
--to=hughd@google.com \
--cc=aarcange@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=linux-arch@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=npiggin@kernel.dk \
--cc=paulmck@linux.vnet.ibm.com \
--cc=peterz@infradead.org \
--cc=riel@redhat.com \
--cc=torvalds@linux-foundation.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox