summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorEric Dumazet <edumazet@google.com>2026-04-09 11:52:38 +0300
committerJakub Kicinski <kuba@kernel.org>2026-04-12 19:05:54 +0300
commit6dd82499fa6c468237801541589eb83023d9fd46 (patch)
tree27146319a8ee3c7a2124fe91fe783381301a3437 /drivers
parent441ec8b5bdcc77f084b63800fd39404d9fc7c9f5 (diff)
downloadlinux-6dd82499fa6c468237801541589eb83023d9fd46.tar.xz
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 <edumazet@google.com> Link: https://patch.msgid.link/20260409085238.1122947-3-edumazet@google.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/ipvlan/ipvlan_core.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/net/ipvlan/ipvlan_core.c b/drivers/net/ipvlan/ipvlan_core.c
index 214fd299a5aa..1be8620ad397 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;