Re: set_current_state

David S. Miller (davem@redhat.com)
Wed, 1 Sep 1999 13:41:22 -0700


Date: Wed, 1 Sep 1999 16:17:07 -0400
From: "Theodore Y. Ts'o" <tytso@mit.edu>

Are there any circumstances where we should keep the old usage?

Fundamentally it only matters when you are going into a "sleep until
condition" polling loop such that:

add_wait_queue(...);
for(;;) {
set_current_state(...);
if (some asynchronous state)
break;
schedule();
}
remove_wait_queue(...);

The idea being that you wish the task state to propagate into the view
of all cpus in the system before other cpus can potentially cause the
asynronous event to occur _and_ check your task state while performing
the wake_up(...)

What we're trying to prevent here is the asynchronous state test load
not bypassing the store of the new task state. If the cpu reorders
these, the wakeup event can be missed.

Later,
David S. Miller
davem@redhat.com

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/