From: Linus Torvalds <torvalds@linux-foundation.org>
To: Eric Dumazet <dada1@cosmosbay.com>
Cc: Shani Moideen <shani.moideen@wipro.com>,
linux-kernel@vger.kernel.org, kernel-janitors@lists.osdl.org
Subject: Re: [PATCH]:Replacing current->state with set_current_state in kernel/signal.c
Date: Wed, 25 Apr 2007 08:45:51 -0700 (PDT) [thread overview]
Message-ID: <alpine.LFD.0.98.0704250843300.9964@woody.linux-foundation.org> (raw)
In-Reply-To: <20070425091724.6f2c212b.dada1@cosmosbay.com>
On Wed, 25 Apr 2007, Eric Dumazet wrote:
>
> Either you think you corrected a BUG, so please state it clearly in
> Changelog so that Linus immediatly apply your patch for 2.6.21 :)
It's not a bug.
Setting current state manually is fine _iff_ you don't actually test a
condition value. It's only if you do
/* This has a race, and is bad! */
current->state = TASK_INTERRUPTIBLE;
if (some_condition)
schedule();
that you have a race: the CPU (or the compiler, for that matter) can move
the "some_condition" check up to before setting TASK_INTERRUPTIBLE, and if
another CPU comes in and wakes you up, you might lose the wakeup.
But doing
/* This is fine */
current->state = TASK_INTERRUPTIBLE;
schedule();
is fine.
Linus
prev parent reply other threads:[~2007-04-25 15:47 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-04-25 6:38 Shani Moideen
2007-04-25 7:17 ` Eric Dumazet
2007-04-25 15:45 ` Linus Torvalds [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=alpine.LFD.0.98.0704250843300.9964@woody.linux-foundation.org \
--to=torvalds@linux-foundation.org \
--cc=dada1@cosmosbay.com \
--cc=kernel-janitors@lists.osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=shani.moideen@wipro.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
all inboxes | Powered by JetHome®