This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Compilers and RCU readers: Once more unto the breach!
- From: "Paul E. McKenney" <paulmck at linux dot vnet dot ibm dot com>
- To: Ramana Radhakrishnan <ramana dot radhakrishnan at arm dot com>
- Cc: David Howells <dhowells at redhat dot com>, Will Deacon <Will dot Deacon at arm dot com>, Linus Torvalds <torvalds at linux-foundation dot org>, Linux Kernel Mailing List <linux-kernel at vger dot kernel dot org>, "c++std-parallel at accu dot org" <c++std-parallel at accu dot org>, "linux-arch at vger dot kernel dot org" <linux-arch at vger dot kernel dot org>, "gcc at gcc dot gnu dot org" <gcc at gcc dot gnu dot org>, p796231 <Peter dot Sewell at cl dot cam dot ac dot uk>, "mark dot batty at cl dot cam dot ac dot uk" <Mark dot Batty at cl dot cam dot ac dot uk>, Peter Zijlstra <peterz at infradead dot org>, Andrew Morton <akpm at linux-foundation dot org>, Ingo Molnar <mingo at kernel dot org>, "michaelw at ca dot ibm dot com" <michaelw at ca dot ibm dot com>
- Date: Wed, 20 May 2015 07:03:43 -0700
- Subject: Re: Compilers and RCU readers: Once more unto the breach!
- Authentication-results: sourceware.org; auth=none
- References: <20150520133037 dot GK6776 at linux dot vnet dot ibm dot com> <20150520121522 dot GH6776 at linux dot vnet dot ibm dot com> <20150520005510 dot GA23559 at linux dot vnet dot ibm dot com> <CA+55aFy_8V-rbE9FQMHx6tXjj8HHKZuKSJvnRPVYvpk46EQA1g at mail dot gmail dot com> <CA+55aFxOtcB8AYCpLQBGSXK=8_Vh4uDs5HEpzGpPy+hgz542ag at mail dot gmail dot com> <20150520024148 dot GD6776 at linux dot vnet dot ibm dot com> <20150520114745 dot GC11498 at arm dot com> <31547 dot 1432127917 at warthog dot procyon dot org dot uk> <31805 dot 1432129025 at warthog dot procyon dot org dot uk> <555C8FBE dot 4020505 at arm dot com>
- Reply-to: paulmck at linux dot vnet dot ibm dot com
On Wed, May 20, 2015 at 02:44:30PM +0100, Ramana Radhakrishnan wrote:
>
>
> On 20/05/15 14:37, David Howells wrote:
> >Paul E. McKenney <paulmck@linux.vnet.ibm.com> wrote:
> >
> >>I was thinking of "y" as a simple variable, but if it is something more
> >>complex, then the compiler could do this, right?
> >>
> >> char *x;
> >>
> >> y;
> >> x = z;
> >
> >Yeah. I presume it has to maintain the ordering, though.
>
> The scheduler for e.g. is free to reorder if it can prove there is
> no dependence (or indeed side-effects for y) between insns produced
> for y and `x = z'.
So for example, if y is independent of z, the compiler can do the
following:
char *x;
x = z;
y;
But the dependency ordering is still maintained from z to x, so this
is not a problem.
Or am I missing something subtle here?
Thanx, Paul