Bluetooth: optimize barrier usage for Rmw atomics
authorDavidlohr Bueso <dave@stgolabs.net>
Wed, 29 Jan 2020 18:10:41 +0000 (10:10 -0800)
committerMarcel Holtmann <marcel@holtmann.org>
Wed, 29 Jan 2020 18:50:44 +0000 (19:50 +0100)
Use smp_mb__before_atomic() instead of smp_mb() and avoid the
unnecessary barrier for non LL/SC architectures, such as x86.

Signed-off-by: Davidlohr Bueso <dbueso@suse.de>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
net/bluetooth/hidp/core.c

index bef84b9..3b4fa27 100644 (file)
@@ -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);