Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1222335

Re: [PATCH] Documentation: Remove misleading examples of the barriers in wake_*()

From Oleg Nesterov <oleg@redhat.com>
Newsgroups linux.kernel
Subject Re: [PATCH] Documentation: Remove misleading examples of the barriers in wake_*()
Date 2015-09-10 20:00 +0200
Message-ID <q7eiC-eo-11@gated-at.bofh.it> (permalink)
References <q6fJL-5Z2-1@gated-at.bofh.it> <q6Tea-3WQ-21@gated-at.bofh.it> <q6ZCW-4Mz-11@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On 09/10, Boqun Feng wrote:
>
> On Wed, Sep 09, 2015 at 12:28:22PM -0700, Paul E. McKenney wrote:
> > My feeling is
> > that we should avoid saying too much about the internals of wait_event()
> > and wake_up().

I feel the same. I simply can't understand what we are trying to
document ;)

For example,

> A STORE-LOAD barrier is implied after setting task state by wait-related functions:
>
> 	prepare_to_wait();
> 	prepare_to_wait_exclusive();
> 	prepare_to_wait_event();

I won't argue, but to me this looks misleading too.

Yes, prepare_to_wait()->set_current_state() implies mb() and thus
a STORE-LOAD barrier.

But this has nothing to do with the explanation above. We do not
need this barrier to avoid the race with wake_up(). Again, again,
we can safely rely on wq->lock and acquire/release semantics.

This barrier is only needed if you do, say,

	CONDITION = 1;

	if (waitqueue_active(wq))
		wake_up(wq);

And note that the code above is wrong without another mb() after
CONDITION = 1.

Oleg.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] Documentation: Remove misleading examples of the barriers in wake_*() Boqun Feng <boqun.feng@gmail.com> - 2015-09-08 03:20 +0200
  Re: [PATCH] Documentation: Remove misleading examples of the  barriers in wake_*() "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2015-09-09 21:30 +0200
    Re: [PATCH] Documentation: Remove misleading examples of the  barriers in wake_*() Boqun Feng <boqun.feng@gmail.com> - 2015-09-10 04:20 +0200
      Re: [PATCH] Documentation: Remove misleading examples of the  barriers in wake_*() Oleg Nesterov <oleg@redhat.com> - 2015-09-10 20:00 +0200
        Re: [PATCH] Documentation: Remove misleading examples of the  barriers in wake_*() Boqun Feng <boqun.feng@gmail.com> - 2015-09-11 19:10 +0200
        Re: [PATCH] Documentation: Remove misleading examples of the  barriers in wake_*() Peter Zijlstra <peterz@infradead.org> - 2015-09-17 15:10 +0200
          Re: [PATCH] Documentation: Remove misleading examples of the  barriers in wake_*() Oleg Nesterov <oleg@redhat.com> - 2015-09-17 19:10 +0200
            Re: [PATCH] Documentation: Remove misleading examples of the  barriers in wake_*() Peter Zijlstra <peterz@infradead.org> - 2015-09-18 09:00 +0200
              Re: [PATCH] Documentation: Remove misleading examples of the  barriers in wake_*() Oleg Nesterov <oleg@redhat.com> - 2015-09-21 19:50 +0200

csiph-web