lkml.org 
[lkml]   [2019]   [Feb]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 37/37] net: Make softirq vector masking finegrained on release_sock()
Date
This is a usage example of spin_lock_bh_mask(). NET_RX, TIMER and
TASKLET are the three softirqs that have been reported by lockdep to
be used for this socket lock, at least on my own usecases.

Reviewed-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Frederic Weisbecker <frederic@kernel.org>
Cc: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Cc: Joel Fernandes <joel@joelfernandes.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Pavan Kondeti <pkondeti@codeaurora.org>
Cc: Paul E . McKenney <paulmck@linux.vnet.ibm.com>
Cc: David S . Miller <davem@davemloft.net>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
---
net/core/sock.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/net/core/sock.c b/net/core/sock.c
index 6aa2e7e0b4fb..d6c7dca82ad9 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -2795,7 +2795,11 @@ EXPORT_SYMBOL(lock_sock_nested);

void release_sock(struct sock *sk)
{
- spin_lock_bh(&sk->sk_lock.slock);
+ unsigned int bh;
+
+ bh = spin_lock_bh_mask(&sk->sk_lock.slock,
+ BIT(NET_RX_SOFTIRQ) | BIT(TIMER_SOFTIRQ) |
+ BIT(HRTIMER_SOFTIRQ) | BIT(TASKLET_SOFTIRQ));
if (sk->sk_backlog.tail)
__release_sock(sk);

@@ -2808,7 +2812,7 @@ void release_sock(struct sock *sk)
sock_release_ownership(sk);
if (waitqueue_active(&sk->sk_lock.wq))
wake_up(&sk->sk_lock.wq);
- spin_unlock_bh(&sk->sk_lock.slock);
+ spin_unlock_bh_mask(&sk->sk_lock.slock, bh);
}
EXPORT_SYMBOL(release_sock);

--
2.21.0
\
 
 \ /
  Last update: 2019-02-28 18:15    [W:0.196 / U:2.628 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site