]> Git Repo - linux.git/commitdiff
net: sock_dequeue_err_skb() optimization
authorEric Dumazet <[email protected]>
Thu, 5 Oct 2023 11:45:04 +0000 (11:45 +0000)
committerJakub Kicinski <[email protected]>
Fri, 6 Oct 2023 23:29:08 +0000 (16:29 -0700)
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]>
net/core/skbuff.c

index da3f96bdd6f66cbea2f8e17513bff05a036a48ac..0401f40973a584ba4a89509b02510c8352bd6fb5 100644 (file)
@@ -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))) {
This page took 0.068624 seconds and 4 git commands to generate.