From: Pavel Machek <pavel@ucw.cz>
To: Oleg Nesterov <oleg@tv-sign.ru>
Cc: Andrew Morton <akpm@linux-foundation.org>,
"Rafael J. Wysocki" <rjw@sisk.pl>,
"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] fix refrigerator() vs thaw_process() race
Date: Mon, 19 Feb 2007 23:47:25 +0100 [thread overview]
Message-ID: <20070219224725.GF21199@elf.ucw.cz> (raw)
In-Reply-To: <20070219121236.GD91@tv-sign.ru>
Hi!
> > > refrigerator() can miss a wakeup, "wait event" loop needs a proper memory
> > > ordering.
> > >
> > > Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru>
> > >
> > > --- WQ/kernel/power/process.c~WAKE 2007-02-18 22:56:49.000000000 +0300
> > > +++ WQ/kernel/power/process.c 2007-02-19 01:04:26.000000000 +0300
> > > @@ -46,8 +46,10 @@ void refrigerator(void)
> > > recalc_sigpending(); /* We sent fake signal, clean it up */
> > > spin_unlock_irq(¤t->sighand->siglock);
> > >
> > > - current->state = TASK_UNINTERRUPTIBLE;
> > > + set_current_state(TASK_UNINTERRUPTIBLE);
> >
> >
> > Looks okay to me... but this one liner would be exactly as effective,
> > right?
>
> I think no, with this one liner we have
>
> while (frozen(current)) {
> // ------ WINDOW ------------
> set_current_state(TASK_UNINTERRUPTIBLE);
> schedule();
> }
>
> What if thaw_process() happens in the window above?
>
> We need the barrier exactly because LOAD (check condition) should not
> come before STORE (set task->state).
Aha, ok :-). You already have my ACK ;-).
Pavel
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
prev parent reply other threads:[~2007-02-20 23:23 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-02-18 22:17 [PATCH] fix refrigerator() vs thaw_process() race Oleg Nesterov
2007-02-18 23:28 ` Rafael J. Wysocki
2007-02-19 10:50 ` Pavel Machek
2007-02-19 12:12 ` Oleg Nesterov
2007-02-19 22:47 ` Pavel Machek [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=20070219224725.GF21199@elf.ucw.cz \
--to=pavel@ucw.cz \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=oleg@tv-sign.ru \
--cc=paulmck@linux.vnet.ibm.com \
--cc=rjw@sisk.pl \
/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