I've been wondering why this is safe on UP.
What's to stop the compiler reordering the write to current->state
after the test for the condition?
Sure, state is declared volatile, but the condition usually isn't and
AFAIK the ordering of volatile operations is only defined with respect
to each other.
Scenario:
current->state = TASK_INTERRUPTIBLE;
if (condition)
Rewritten by compiler as:
tmp = condition;
/* Interrupt occurs here. */
current->state = TASK_INTERRUPTIBLE;
if (tmp)
Just a thought. Obviously it never happens so I must be missing
something :-)
-- Jamie
-
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/
-
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/
-
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/