macvlan: avoid spinlock contention in macvlan_broadcast_enqueue()

Under high stress, we spend a lot of time cloning skbs,
then acquiring a spinlock, then freeing the clone because
the queue is full.

Add a shortcut to avoid these costs under pressure.

Signed-off-by: Eric Dumazet <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Jakub Kicinski <[email protected]>
This commit is contained in:
Eric Dumazet
2026-04-02 17:56:35 -07:00
committed by Jakub Kicinski
parent 1ef5789d99
commit 0d5dc1d7aa
+3
View File
@@ -360,6 +360,9 @@ static void macvlan_broadcast_enqueue(struct macvlan_port *port,
struct sk_buff *nskb;
int err = -ENOMEM;
if (skb_queue_len_lockless(&port->bc_queue) >= bc_queue_len_used)
goto err;
nskb = skb_clone(skb, GFP_ATOMIC);
if (!nskb)
goto err;