futex: Fix barrier comment
authorDavidlohr Bueso <dave@stgolabs.net>
Wed, 6 Feb 2019 18:56:02 +0000 (10:56 -0800)
committerThomas Gleixner <tglx@linutronix.de>
Fri, 8 Feb 2019 12:00:35 +0000 (13:00 +0100)
The current comment for the barrier that guarantees that waiter increment
is always before taking the hb spinlock (barrier (A)) needs to be fixed as
it is misplaced.

This is obviously referring to hb_waiters_inc, which is a full barrier.

Reported-by: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Davidlohr Bueso <dbueso@suse.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lkml.kernel.org/r/20190206185602.949-1-dave@stgolabs.net
kernel/futex.c

index fdd312da09927ad43e2b6dabd7b089d3c2e8393b..5ec2473a3497df3babd92227c11a089d79e05374 100644 (file)
@@ -2221,11 +2221,11 @@ static inline struct futex_hash_bucket *queue_lock(struct futex_q *q)
         * decrement the counter at queue_unlock() when some error has
         * occurred and we don't end up adding the task to the list.
         */
-       hb_waiters_inc(hb);
+       hb_waiters_inc(hb); /* implies smp_mb(); (A) */
 
        q->lock_ptr = &hb->lock;
 
-       spin_lock(&hb->lock); /* implies smp_mb(); (A) */
+       spin_lock(&hb->lock);
        return hb;
 }