]> git.hungrycats.org Git - linux/commit
[PATCH] x86 bitops.h commentary on instruction reordering
authorMarcelo Tosatti <marcelo.tosatti@cyclades.com>
Tue, 24 Aug 2004 04:24:57 +0000 (21:24 -0700)
committerLinus Torvalds <torvalds@ppc970.osdl.org>
Tue, 24 Aug 2004 04:24:57 +0000 (21:24 -0700)
commitc524e494f651156938ff2d76f22ad17231b77e20
tree7cb1dd178240a5efff544cdf207260cd61987f45
parent6992904141794e1d5f6ef2e9b770ba491550a237
[PATCH] x86 bitops.h commentary on instruction reordering

Back when we were discussing the need for a memory barrier in sync_page(),
it came to me (thanks Andrea!) that the bit operations can be perfectly
reordered on architectures other than x86.

I think the commentary on i386 bitops.h is misleading, its worth to note
that that these operations are not guaranteed not to be reordered on
different architectures.

clear_bit() already does that:

 * clear_bit() is atomic and may not be reordered.  However, it does
 * not contain a memory barrier, so if it is used for locking purposes,
 * you should call smp_mb__before_clear_bit() and/or smp_mb__after_clear_bit()
 * in order to ensure changes are visible on other processors.

Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
include/asm-i386/bitops.h