> >Hold on: even if the machine has a single CPU, you still need to
> >guarantee atomicity because of interrupt handlers. On a single CPU
> >machine you could do this by disabling interrupts. But you can't
> >just ignore the whole issue because you only have one CPU.
>
> Woops, I think that test_and_set_bit() has to be atomic only in respect of
> SMP (as i386 implementation). Maybe "atomic" is not the best word to
> describe test_and_set_bit(), "SMP safe" should feel better...
Nuff, see Ethernet drivers' transmit function:
/* Block a timer-based transmit from overlapping. This could better be
done with atomic_swap(1, dev->tbusy), but set_bit() works as well. */
if (test_and_set_bit(0, (void*)&dev->tbusy) != 0) {
printk("%s: Transmitter access conflict.\n", dev->name);
return 1;
}
Ralf
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu