]> git.baikalelectronics.ru Git - kernel.git/commit
net: properly flush delay-freed skbs
authorEric Dumazet <edumazet@google.com>
Wed, 23 Nov 2016 16:44:56 +0000 (08:44 -0800)
committerDavid S. Miller <davem@davemloft.net>
Sat, 26 Nov 2016 00:37:49 +0000 (19:37 -0500)
commitb55daffab2c1eba1d4a73f6c33a9f789d61a068c
treea5532c4e1afd9e1a48a3c4a6f17f69af91344fe4
parent1c3673a9c7dbf3846903754899e782ed8982f06f
net: properly flush delay-freed skbs

Typical NAPI drivers use napi_consume_skb(skb) at TX completion time.
This put skb in a percpu special queue, napi_alloc_cache, to get bulk
frees.

It turns out the queue is not flushed and hits the NAPI_SKB_CACHE_SIZE
limit quite often, with skbs that were queued hundreds of usec earlier.
I measured this can take ~6000 nsec to perform one flush.

__kfree_skb_flush() can be called from two points right now :

1) From net_tx_action(), but only for skbs that were queued to
sd->completion_queue.

 -> Irrelevant for NAPI drivers in normal operation.

2) From net_rx_action(), but only under high stress or if RPS/RFS has a
pending action.

This patch changes net_rx_action() to perform the flush in all cases and
after more urgent operations happened (like kicking remote CPUS for
RPS/RFS).

Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Jesper Dangaard Brouer <brouer@redhat.com>
Cc: Alexander Duyck <alexander.h.duyck@intel.com>
Acked-by: Alexander Duyck <alexander.h.duyck@intel.com>
Acked-by: Jesper Dangaard Brouer <brouer@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/core/dev.c