]> git.hungrycats.org Git - linux/commitdiff
[PATCH] document wake_up_bit()'s requirement for preceding memory barriers
authorWilliam Lee Irwin III <wli@holomorphy.com>
Tue, 19 Oct 2004 01:00:51 +0000 (18:00 -0700)
committerLinus Torvalds <torvalds@ppc970.osdl.org>
Tue, 19 Oct 2004 01:00:51 +0000 (18:00 -0700)
Document the requirement to use a memory barrier prior to wake_up_bit().

Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
kernel/wait.c

index 1ca53daecd916039a69781d89be13967c4f2ef07..791681cfea981d49e5b9f74de41f928c1c8da38b 100644 (file)
@@ -221,6 +221,13 @@ EXPORT_SYMBOL(__wake_up_bit);
  * is the part of the hashtable's accessor API that wakes up waiters
  * on a bit. For instance, if one were to have waiters on a bitflag,
  * one would call wake_up_bit() after clearing the bit.
+ *
+ * In order for this to function properly, as it uses waitqueue_active()
+ * internally, some kind of memory barrier must be done prior to calling
+ * this. Typically, this will be smp_mb__after_clear_bit(), but in some
+ * cases where bitflags are manipulated non-atomically under a lock, one
+ * may need to use a less regular barrier, such fs/inode.c's smp_mb(),
+ * because spin_unlock() does not guarantee a memory barrier.
  */
 void fastcall wake_up_bit(void *word, int bit)
 {