From: Peter Zijlstra <peterz@infradead.org>
To: Boqun Feng <boqun.feng@gmail.com>
Cc: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>,
Oleg Nesterov <oleg@redhat.com>,
linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org,
Jonathan Corbet <corbet@lwn.net>,
Michal Hocko <mhocko@kernel.org>,
David Howells <dhowells@redhat.com>,
Linus Torvalds <torvalds@linux-foundation.org>,
Will Deacon <will.deacon@arm.com>
Subject: Re: [PATCH] Documentation: Remove misleading examples of the barriers in wake_*()
Date: Mon, 12 Oct 2015 18:26:53 +0200 [thread overview]
Message-ID: <20151012162653.GN3604@twins.programming.kicks-ass.net> (raw)
In-Reply-To: <20151012130924.GH27351@fixme-laptop.cn.ibm.com>
On Mon, Oct 12, 2015 at 09:09:24PM +0800, Boqun Feng wrote:
> On Mon, Oct 12, 2015 at 01:54:38PM +0200, Peter Zijlstra wrote:
> > On Mon, Oct 12, 2015 at 05:06:36PM +0800, Boqun Feng wrote:
> > > Understood.
> > >
> > > But, IMO, the position of this section is already misleading:
> > >
> > > (*) Implicit kernel memory barriers.
> > > - Locking functions.
> > > - Interrupt disabling functions.
> > > ->- Sleep and wake-up functions.<-
> > > - Miscellaneous functions.
> > >
> > > I read it as that sleep and wake-up functions provide some kernel memory
> > > barriers which we can use *externally*(outside sleep/wakeup themselves).
> >
> > I think it is useful to state that the primitives handle the ordering
> > between the waker and wakee wrt the 'blocking' state.
> >
>
> I agree that's useful, however, the 'blocking' state is something
> internal for sleep and wakeup, right?
Not entirely; its also the @cond thing in wait queues. IE:
for (;;)
set_current_state(TASK_INTERRUPTIBLE);
if (@cond)
break;
schedule();
}
__set_current_state(TASK_RUNNING);
vs.
@cond = true;
wake_up_process(p);
So we guarantee that 'p' will see the @cond stores IF it does the
wakeup. (If it does not, ie. 'p' wasn't sleeping, any guarantee is out
the window).
> Not sure whether the users of
> wake_up() and wait_event() will care much about this or they need to
> understand that detailedly to use wake_up() and wait_event() correctly.
I think its mostly natural; but it explains why you don't have to do:
wait_event(wq, @cond);
vs.
@cond = true;
smp_wmb();
wake_up(wq);
(or worse...)
> > But I've not put much thought into wording. I wanted to finish process
> > order 'comment' patch first.
>
> Of course. Actually your 'comment' patch is the reason why I think this
> section may be removed.
Yes, that is another option, referring to the comment, once that's
sorted.
prev parent reply other threads:[~2015-10-12 16:26 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-08 1:14 [PATCH] Documentation: Remove misleading examples of the barriers in wake_*() Boqun Feng
2015-09-09 19:28 ` Paul E. McKenney
2015-09-10 2:16 ` Boqun Feng
2015-09-10 17:55 ` Oleg Nesterov
2015-09-11 16:59 ` Boqun Feng
2015-09-17 13:01 ` Peter Zijlstra
2015-09-17 17:01 ` Oleg Nesterov
2015-09-18 6:49 ` Peter Zijlstra
2015-09-21 17:46 ` Oleg Nesterov
2015-10-06 16:04 ` Peter Zijlstra
2015-10-06 16:24 ` Peter Zijlstra
2015-10-06 16:35 ` Will Deacon
2015-10-06 19:57 ` Peter Zijlstra
2015-10-07 11:10 ` Peter Zijlstra
2015-10-07 15:40 ` Paul E. McKenney
2015-09-24 13:21 ` Boqun Feng
2015-10-06 16:06 ` Peter Zijlstra
2015-10-11 15:26 ` Boqun Feng
2015-10-12 0:40 ` Paul E. McKenney
2015-10-12 9:06 ` Boqun Feng
2015-10-12 11:54 ` Peter Zijlstra
2015-10-12 13:09 ` Boqun Feng
2015-10-12 16:26 ` Peter Zijlstra [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=20151012162653.GN3604@twins.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=boqun.feng@gmail.com \
--cc=corbet@lwn.net \
--cc=dhowells@redhat.com \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mhocko@kernel.org \
--cc=oleg@redhat.com \
--cc=paulmck@linux.vnet.ibm.com \
--cc=torvalds@linux-foundation.org \
--cc=will.deacon@arm.com \
/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;
as well as URLs for NNTP newsgroup(s).