Messages in this thread | | | Date | Wed, 25 Apr 2007 08:45:51 -0700 (PDT) | From | Linus Torvalds <> | 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@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |