[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <alpine.LFD.0.98.0704250843300.9964@woody.linux-foundation.org>
Date: Wed, 25 Apr 2007 08:45:51 -0700 (PDT)
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: Eric Dumazet <dada1@...mosbay.com>
cc: Shani Moideen <shani.moideen@...ro.com>,
linux-kernel@...r.kernel.org, kernel-janitors@...ts.osdl.org
Subject: Re: [PATCH]:Replacing current->state with set_current_state in
kernel/signal.c
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
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists