Re: [PATCH]:Replacing current->state with set_current_state in kernel/signal.c

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




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 [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux