Linux-Bluetooth Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] bluetooth: optimize barrier usage for Rmw atomics
@ 2020-01-29 18:10 Davidlohr Bueso
  2020-01-29 19:03 ` Marcel Holtmann
  0 siblings, 1 reply; 2+ messages in thread
From: Davidlohr Bueso @ 2020-01-29 18:10 UTC (permalink / raw)
  To: marcel
  Cc: johan.hedberg, linux-kernel, linux-bluetooth, Davidlohr Bueso,
	Davidlohr Bueso

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>
---
 net/bluetooth/hidp/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/bluetooth/hidp/core.c b/net/bluetooth/hidp/core.c
index bef84b95e2c4..3b4fa27a44e6 100644
--- a/net/bluetooth/hidp/core.c
+++ b/net/bluetooth/hidp/core.c
@@ -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);
-- 
2.16.4


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] bluetooth: optimize barrier usage for Rmw atomics
  2020-01-29 18:10 [PATCH] bluetooth: optimize barrier usage for Rmw atomics Davidlohr Bueso
@ 2020-01-29 19:03 ` Marcel Holtmann
  0 siblings, 0 replies; 2+ messages in thread
From: Marcel Holtmann @ 2020-01-29 19:03 UTC (permalink / raw)
  To: Davidlohr Bueso
  Cc: Johan Hedberg, linux-kernel, linux-bluetooth, Davidlohr Bueso

Hi Davidlohr,

> 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>
> ---
> net/bluetooth/hidp/core.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)

patch has been applied to bluetooth-next tree.

Regards

Marcel


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-29 18:10 [PATCH] bluetooth: optimize barrier usage for Rmw atomics Davidlohr Bueso
2020-01-29 19:03 ` Marcel Holtmann

Linux-Bluetooth Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-bluetooth/0 linux-bluetooth/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-bluetooth linux-bluetooth/ https://lore.kernel.org/linux-bluetooth \
		linux-bluetooth@vger.kernel.org
	public-inbox-index linux-bluetooth

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-bluetooth


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git