Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1692467
| From | Boqun Feng <boqun.feng@gmail.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH] documentation: Fix two-CPU control-dependency example |
| Date | 2017-07-20 08:20 +0200 |
| Message-ID | <u5cYx-3ja-9@gated-at.bofh.it> (permalink) |
| References | (1 earlier) <u51gK-3tP-19@gated-at.bofh.it> <u54Rk-5Zi-27@gated-at.bofh.it> <u55aG-67b-19@gated-at.bofh.it> <u58BA-51-3@gated-at.bofh.it> <u5cvv-2QZ-13@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Wed, Jul 19, 2017 at 10:47:04PM -0700, Paul E. McKenney wrote:
[...]
> > Hi Paul,
> >
> > I know the compiler could optimize atomics in very interesting ways, but
> > this case is about volatile, so I guess our case is still fine? ;-)
>
> Hello, Boqun,
>
> When I asked that question, the answer I got was "the compiler must
> emit the load instruction, but is under no obligation to actually use the
> value loaded".
>
> I don't happen to like that answer, by the way. ;-)
>
Me neither, seems to me the kernel happens to work well at
compiler-optimization's mercy ;-/
With claim like that, compiler could do optimization as turning:
struct task_struct *owner;
for (;;) {
owner = READ_ONCE(lock->owner);
if (owner && !mutex_spin_on_owner(lock, owner))
break;
/* ... */
into:
struct task_struct *owner;
owner = READ_ONCE(lock->owner);
for (;;READ_ONCE(lock->owner)) {
if (owner && !mutex_spin_on_owner(lock, owner))
break;
/* ... */
Because the load executed in every loop, and they just happen to choose
not to use the values. And this is within their rights!
Regards,
Boqun
> Thanx, Paul
>
> > > http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0062r1.html
> > >
> >
> > Great material to wake up mind in the morning! Thanks.
> >
> > Regards,
> > Boqun
> >
> > > What are your thoughts on this?
> > >
> > > Thanx, Paul
> > >
> > > > Thanks, Akira
> > > >
> > > > > That said, I very much welcome critical reviews of memory-barriers.txt,
> > > > > so please do feel free to continue doing that!
> > > > >
> > > > > Thanx, Paul
> > > > >
> > > > >
> > > >
> > >
> >
>
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Re: [PATCH] documentation: Fix two-CPU control-dependency example "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2017-07-19 19:50 +0200
Re: [PATCH] documentation: Fix two-CPU control-dependency example Akira Yokosawa <akiyks@gmail.com> - 2017-07-19 23:40 +0200
Re: [PATCH] documentation: Fix two-CPU control-dependency example "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2017-07-20 00:00 +0200
Re: [PATCH] documentation: Fix two-CPU control-dependency example Boqun Feng <boqun.feng@gmail.com> - 2017-07-20 03:40 +0200
Re: [PATCH] documentation: Fix two-CPU control-dependency example "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2017-07-20 07:50 +0200
Re: [PATCH] documentation: Fix two-CPU control-dependency example Boqun Feng <boqun.feng@gmail.com> - 2017-07-20 08:20 +0200
Re: [PATCH] documentation: Fix two-CPU control-dependency example "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2017-07-20 15:00 +0200
Re: [PATCH] documentation: Fix two-CPU control-dependency example Akira Yokosawa <akiyks@gmail.com> - 2017-07-20 15:00 +0200
Re: [PATCH] documentation: Fix two-CPU control-dependency example "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2017-07-20 18:20 +0200
Re: [PATCH] documentation: Fix two-CPU control-dependency example Akira Yokosawa <akiyks@gmail.com> - 2017-07-20 23:20 +0200
Re: [PATCH] documentation: Fix two-CPU control-dependency example "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2017-07-20 23:50 +0200
Re: [PATCH] documentation: Fix two-CPU control-dependency example Akira Yokosawa <akiyks@gmail.com> - 2017-07-21 01:00 +0200
Re: [PATCH] documentation: Fix two-CPU control-dependency example "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2017-07-21 01:10 +0200
Re: [PATCH] documentation: Fix two-CPU control-dependency example Boqun Feng <boqun.feng@gmail.com> - 2017-07-21 02:30 +0200
Re: [PATCH] documentation: Fix two-CPU control-dependency example "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2017-07-21 18:40 +0200
Re: [PATCH] documentation: Fix two-CPU control-dependency example Akira Yokosawa <akiyks@gmail.com> - 2017-07-22 01:40 +0200
Re: [PATCH] documentation: Fix two-CPU control-dependency example "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2017-07-23 06:50 +0200
Re: [PATCH] documentation: Fix two-CPU control-dependency example Boqun Feng <boqun.feng@gmail.com> - 2017-07-23 17:40 +0200
Re: [PATCH] documentation: Fix two-CPU control-dependency example Akira Yokosawa <akiyks@gmail.com> - 2017-07-24 02:10 +0200
Re: [PATCH] documentation: Fix two-CPU control-dependency example "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2017-07-24 06:40 +0200
Re: [PATCH] documentation: Fix two-CPU control-dependency example Boqun Feng <boqun.feng@gmail.com> - 2017-07-24 08:40 +0200
Re: [PATCH] documentation: Fix two-CPU control-dependency example Akira Yokosawa <akiyks@gmail.com> - 2017-07-24 12:50 +0200
csiph-web