Skip to contentSkip to conversation

kernel/futex: Fix barrier comment

PATCH New Davidlohr Bueso 2 participants 2 messages Feb 6, 2019 – Feb 8, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kernel/futex: Fix barrier comment

The current comment for the barrier that guarantees that waiter increment is always before taking the hb spinlock (barrier (A)) needs to be fixed. We are obviously referring to hb_waiters_inc, which is a full barrier.

---
 kernel/futex.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
kernel/futex.c +2 -2
index fdd312da0992..5ec2473a3497 100644
@@ -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;
 }
 
Signature · 1 line
2.16.4
#1 lore raw

[tip:locking/urgent] futex: Fix barrier comment

futex: Fix barrier comment
Commit-ID:  6f568ebe2afefdc33a6fb06ef20a94f8b96455f1
Gitweb:     https://git.kernel.org/tip/6f568ebe2afefdc33a6fb06ef20a94f8b96455f1
Author:     Davidlohr Bueso <[email protected]>
AuthorDate: Wed, 6 Feb 2019 10:56:02 -0800
Committer:  Thomas Gleixner <[email protected]>
CommitDate: Fri, 8 Feb 2019 13:00:35 +0100

futex: Fix barrier comment

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.

---
 kernel/futex.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
kernel/futex.c +2 -2
index fdd312da0992..5ec2473a3497 100644
@@ -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;
 }