[PATCH] Fix memory ordering problem in wake_futex()

Fix a memory ordering problem that occurs on IA64. The "store" to q->lock_ptr
in wake_futex() can become visible before wake_up_all() clears the lock in the
futex_q.

Signed-off-by: Jack Steiner <steiner@sgi.com>
Acked-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>

authored by Andrew Morton and committed by Linus Torvalds 8e31108b 6003a93e

+6
+6
kernel/futex.c
··· 270 /* 271 * The waiting task can free the futex_q as soon as this is written, 272 * without taking any locks. This must come last. 273 */ 274 q->lock_ptr = NULL; 275 } 276
··· 270 /* 271 * The waiting task can free the futex_q as soon as this is written, 272 * without taking any locks. This must come last. 273 + * 274 + * A memory barrier is required here to prevent the following store 275 + * to lock_ptr from getting ahead of the wakeup. Clearing the lock 276 + * at the end of wake_up_all() does not prevent this store from 277 + * moving. 278 */ 279 + wmb(); 280 q->lock_ptr = NULL; 281 } 282