Skip to contentSkip to conversation

bluetooth: optimize barrier usage for Rmw atomics

PATCH In review Davidlohr Bueso 2 participants 2 messages Jan 29, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 bluetooth: optimize barrier usage for Rmw atomics

Use smp_mb__before_atomic() instead of smp_mb() and avoid the unnecessary barrier for non LL/SC architectures, such as x86.

---
 net/bluetooth/hidp/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/bluetooth/hidp/core.c +1 -1
index bef84b95e2c4..3b4fa27a44e6 100644
@@ -1279,7 +1279,7 @@ static int hidp_session_thread(void *arg)
 	add_wait_queue(sk_sleep(session->intr_sock->sk), &intr_wait);
 	/* This memory barrier is paired with wq_has_sleeper(). See
 	 * sock_poll_wait() for more information why this is needed. */
-	smp_mb();
+	smp_mb__before_atomic();
 
 	/* notify synchronous startup that we're ready */
 	atomic_inc(&session->state);
Signature · 1 line
2.16.4
maintainer
#1 lore raw

Hi Davidlohr,

Quoted 7 lines

Use smp_mb__before_atomic() instead of smp_mb() and avoid the unnecessary barrier for non LL/SC architectures, such as x86.

---
net/bluetooth/hidp/core.c | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)

patch has been applied to bluetooth-next tree.

Regards

Marcel