From: Oleg Nesterov <oleg@tv-sign.ru>
To: Pavel Machek <pavel@ucw.cz>
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 15:12:36 +0300 [thread overview]
Message-ID: <20070219121236.GD91@tv-sign.ru> (raw)
In-Reply-To: <20070219105008.GA19184@elf.ucw.cz>
On 02/19, Pavel Machek wrote:
>
> > 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).
Oleg.
next prev parent reply other threads:[~2007-02-19 12:13 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 [this message]
2007-02-19 22:47 ` Pavel Machek
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=20070219121236.GD91@tv-sign.ru \
--to=oleg@tv-sign.ru \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=paulmck@linux.vnet.ibm.com \
--cc=pavel@ucw.cz \
--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