Re: [PATCH] Fix the cpumask rewrite

From: Linus Torvalds
Date: Sat Jun 26 2004 - 11:47:38 EST




On Sat, 26 Jun 2004, Linus Torvalds wrote:
>
> Why not? The thing is, the bitmap operators are supposed to work on
> volatile data, ie people are literally using them for things like
>
> while (test_bit(TASKLET_STATE_SCHED, &t->state));

Ahh. That one is part of a "do while ()" loop, and grep mis-identifies it.
So parisc gets it right, because the whole loop is

do
yield();
while (test_bit(TASKLET_STATE_SCHED, &t->state));

so at least the compiler didn't get to optimize it away.

Hopefully we don't have any other busy loops either - even if it is a busy
loop, we should have a "cpu_relax()" or something there just to keep power
levels down, and that should also tell the compiler not to do anything
silly. But the conceptual point stands.

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