[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <00c765d3-e893-daa0-e5bb-790b1b790f29@solarflare.com>
Date: Tue, 26 Jun 2018 19:21:00 +0100
From: Edward Cree <ecree@...arflare.com>
To: <linux-net-drivers@...arflare.com>, <netdev@...r.kernel.org>
CC: <davem@...emloft.net>
Subject: [RFC PATCH v2 net-next 09/12] net: don't bother calling list RX
functions on empty lists
Generally the check should be very cheap, as the sk_buff_head is in cache.
Signed-off-by: Edward Cree <ecree@...arflare.com>
---
net/core/dev.c | 8 ++++++--
net/ipv4/ip_input.c | 2 ++
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/net/core/dev.c b/net/core/dev.c
index f0eb00e9fb57..11f80d4502b9 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -4780,7 +4780,8 @@ static void __netif_receive_skb_list(struct sk_buff_head *list)
while ((skb = __skb_dequeue(list)) != NULL) {
if ((sk_memalloc_socks() && skb_pfmemalloc(skb)) != pfmemalloc) {
/* Handle the previous sublist */
- __netif_receive_skb_list_core(&sublist, pfmemalloc);
+ if (!skb_queue_empty(&sublist))
+ __netif_receive_skb_list_core(&sublist, pfmemalloc);
pfmemalloc = !pfmemalloc;
/* See comments in __netif_receive_skb */
if (pfmemalloc)
@@ -4792,7 +4793,8 @@ static void __netif_receive_skb_list(struct sk_buff_head *list)
__skb_queue_tail(&sublist, skb);
}
/* Handle the last sublist */
- __netif_receive_skb_list_core(&sublist, pfmemalloc);
+ if (!skb_queue_empty(&sublist))
+ __netif_receive_skb_list_core(&sublist, pfmemalloc);
/* Restore pflags */
if (pfmemalloc)
memalloc_noreclaim_restore(noreclaim_flag);
@@ -4968,6 +4970,8 @@ void netif_receive_skb_list(struct sk_buff_head *list)
{
struct sk_buff *skb;
+ if (skb_queue_empty(list))
+ return;
skb_queue_for_each(skb, list)
trace_netif_receive_skb_list_entry(skb);
netif_receive_skb_list_internal(list);
diff --git a/net/ipv4/ip_input.c b/net/ipv4/ip_input.c
index 63d4dfdb1766..65a5ed9e4b3c 100644
--- a/net/ipv4/ip_input.c
+++ b/net/ipv4/ip_input.c
@@ -570,6 +570,8 @@ static void ip_sublist_rcv(struct sk_buff_head *list, struct net_device *dev,
{
struct sk_buff_head sublist;
+ if (skb_queue_empty(list))
+ return;
NF_HOOK_LIST(NFPROTO_IPV4, NF_INET_PRE_ROUTING, net, NULL,
list, &sublist, dev, NULL, ip_rcv_finish);
ip_list_rcv_finish(net, NULL, &sublist);
Powered by blists - more mailing lists