diff options
| author | Eric Dumazet <[email protected]> | 2023-10-05 11:45:04 +0000 |
|---|---|---|
| committer | Jakub Kicinski <[email protected]> | 2023-10-06 16:29:08 -0700 |
| commit | 48533eca606efcf63ef4080ded5618e0b17ee3d7 (patch) | |
| tree | 6d8d31948a88e1b196c2b631b20f5d2a5af98197 | |
| parent | a1fb841f9d189d257814562dacb3d65667f2a9c3 (diff) | |
net: sock_dequeue_err_skb() optimization
Exit early if the list is empty.
Some applications using TCP zerocopy are calling
recvmsg( ... MSG_ERRQUEUE) and hit this case quite often,
probably because busy polling only deals with sk_receive_queue.
Signed-off-by: Eric Dumazet <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Jakub Kicinski <[email protected]>
| -rw-r--r-- | net/core/skbuff.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/net/core/skbuff.c b/net/core/skbuff.c index da3f96bdd6f6..0401f40973a5 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c @@ -5162,6 +5162,9 @@ struct sk_buff *sock_dequeue_err_skb(struct sock *sk) bool icmp_next = false; unsigned long flags; + if (skb_queue_empty_lockless(q)) + return NULL; + spin_lock_irqsave(&q->lock, flags); skb = __skb_dequeue(q); if (skb && (skb_next = skb_peek(q))) { |