Re: Inconsistency in changing the state of task ??

From: Robert Love (rml@tech9.net)
Date: Tue Mar 04 2003 - 12:51:23 EST


On Tue, 2003-03-04 at 03:36, prash_t@softhome.net wrote:

> while browsing through fs/select.c file of 2.4.19, I came across two
> DIFFERENT ways of changing the state of the current task in do_select():
>
> set_current_state = TASK_INTERRUPTIBLE;
> AND current->state = TASK_RUNNING;
>
> I am curious to know if the second line of code doesn't cause any problem in
> SMP systems. I also see the same situation in do_poll().

You normally want to use set_current_state(), which is a nice
abstraction and safe for SMP.

Sometimes it is safe to use __set_current_state(), which does not
provide a memory barrier.

The above open-coded line can be changed to
__set_current_state(TASK_RUNNING).

        Robert Love

-
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/



This archive was generated by hypermail 2b29 : Fri Mar 07 2003 - 22:00:25 EST