From: "Dmitry Adamushko" <dmitry.adamushko@gmail.com>
To: "Rusty Russell" <rusty@rustcorp.com.au>
Cc: "Andrew Morton" <akpm@linux-foundation.org>,
linux-kernel@vger.kernel.org,
"Nick Piggin" <nickpiggin@yahoo.com.au>,
"Ingo Molnar" <mingo@elte.hu>,
"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>,
"Peter Zijlstra" <a.p.zijlstra@chello.nl>,
"Andy Whitcroft" <apw@shadowen.org>
Subject: Re: [PATCH 1/2] kthread: add a missing memory barrier to kthread_stop()
Date: Sun, 2 Mar 2008 23:28:35 +0100 [thread overview]
Message-ID: <b647ffbd0803021428h277ed1e0q6d302f0ae9392346@mail.gmail.com> (raw)
In-Reply-To: <200803030850.57615.rusty@rustcorp.com.au>
On 02/03/2008, Rusty Russell <rusty@rustcorp.com.au> wrote:
> On Thursday 21 February 2008 08:36:30 Dmitry Adamushko wrote:
> > From: Dmitry Adamushko <dmitry.adamushko@gmail.com>
> > Subject: kthread: add a missing memory barrier to kthread_stop()
> >
> > We must ensure that kthread_stop_info.k has been updated before
> > kthread's wakeup. This is required to properly support
> > the use of kthread_should_stop() in the main loop of kthread.
> >
> > wake_up_process() doesn't imply a full memory barrier,
> > so we add an explicit one.
>
>
> I always believed that wake_up_process() implies a write barrier. It's pretty
> common to set something up then wake the intended recipient.
No, it didn't imply a write mb. Moreover, the situation I tried to
address required a full mb (write vs. read ops. synchronization).
Please take a look at the discussion here http://lkml.org/lkml/2008/2/23/238
and here is a more detailed description of the problem :
http://groups.google.com/group/fa.linux.kernel/browse_thread/thread/44c45685680585fc/e58785df0eeee6f8?lnk=raot
>
> So I think this patch is overkill, but I'm happy to be corrected.
We ended up adding an explicit smp_wmb() (a patch by Linus) to the
very beginning of try_to_wake_up(). Combined with the following
spin_lock() it acts as a 'full' mb for write vs. read ('read' takes
place inside try_to_wake_up()) and that's exactly what we need here.
The 1st link mentioned above may provide more details for interested readers.
So yes, now that we have got smp_wmb() in try_to_wake_up() this patch
is redundant.
>
> Thanks!
>
> Rusty.
>
--
Best regards,
Dmitry Adamushko
prev parent reply other threads:[~2008-03-02 22:28 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-02-20 21:36 Dmitry Adamushko
2008-03-02 21:50 ` Rusty Russell
2008-03-02 22:28 ` Dmitry Adamushko [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=b647ffbd0803021428h277ed1e0q6d302f0ae9392346@mail.gmail.com \
--to=dmitry.adamushko@gmail.com \
--cc=a.p.zijlstra@chello.nl \
--cc=akpm@linux-foundation.org \
--cc=apw@shadowen.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=nickpiggin@yahoo.com.au \
--cc=paulmck@linux.vnet.ibm.com \
--cc=rusty@rustcorp.com.au \
/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
all inboxes | Powered by JetHome®