From: Eric Dumazet Date: Thu, 9 Apr 2026 08:52:38 +0000 (+0000) Subject: ipvlan: avoid spinlock contention in ipvlan_multicast_enqueue() X-Git-Tag: v7.1-rc1~173^2~43^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=6dd82499fa6c468237801541589eb83023d9fd46;p=thirdparty%2Fkernel%2Flinux.git ipvlan: avoid spinlock contention in ipvlan_multicast_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, as we did in macvlan with commit 0d5dc1d7aad1 ("macvlan: avoid spinlock contention in macvlan_broadcast_enqueue()") Signed-off-by: Eric Dumazet Link: https://patch.msgid.link/20260409085238.1122947-3-edumazet@google.com Signed-off-by: Jakub Kicinski --- diff --git a/drivers/net/ipvlan/ipvlan_core.c b/drivers/net/ipvlan/ipvlan_core.c index 214fd299a5aa6..1be8620ad3971 100644 --- a/drivers/net/ipvlan/ipvlan_core.c +++ b/drivers/net/ipvlan/ipvlan_core.c @@ -763,10 +763,16 @@ static rx_handler_result_t ipvlan_handle_mode_l2(struct sk_buff **pskb, 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;