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, as we did
in macvlan with commit
0d5dc1d7aad1 ("macvlan: avoid spinlock
contention in macvlan_broadcast_enqueue()")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Link: https://patch.msgid.link/20260409085238.1122947-3-edumazet@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
if (!ipvlan_external_frame(skb, port))
return RX_HANDLER_PASS;
- nskb = skb_clone(skb, GFP_ATOMIC);
+ if (skb_queue_len_lockless(&port->backlog) >= IPVLAN_QBACKLOG_LIMIT)
+ nskb = NULL;
+ else
+ nskb = skb_clone(skb, GFP_ATOMIC);
+
if (nskb) {
ipvlan_skb_crossing_ns(nskb, NULL);
ipvlan_multicast_enqueue(port, nskb, false);
+ } else {
+ dev_core_stats_rx_dropped_inc(skb->dev);
}
return RX_HANDLER_PASS;