lkml.org 
[lkml]   [2007]   [Apr]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2007-04-25 17:51    [W:0.039 / U:0.028 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site