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 --- drivers/net/ipvlan/ipvlan_core.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/net/ipvlan/ipvlan_core.c b/drivers/net/ipvlan/ipvlan_core.c index 214fd299a5aa6e40579aa2dbcb178b5474b561a4..1be8620ad3971d281fb36fd0770efd67b566ae60 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; -- 2.53.0.1213.gd9a14994de-goog