[rh7,11/11] net: don't bother calling list RX functions on empty lists

Submitted by Andrey Ryabinin on Sept. 10, 2018, 3:39 p.m.

Details

Message ID 20180910153940.22827-12-aryabinin@virtuozzo.com
State New
Series "Backort of "Handle multiple received packets at each stage""
Headers show

Commit Message

Andrey Ryabinin Sept. 10, 2018, 3:39 p.m.
From: Edward Cree <ecree@solarflare.com>

Generally the check should be very cheap, as the sk_buff_head is in cache.

Signed-off-by: Edward Cree <ecree@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

https://jira.sw.ru/browse/PSBM-88420
(cherry picked from commit b9f463d6c9849230043123a6335d59ac7fea4d5a)
Signed-off-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
---
 net/core/dev.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

Patch hide | download patch | download mbox

diff --git a/net/core/dev.c b/net/core/dev.c
index 0ab07300c15b..fdc1da808894 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -4299,7 +4299,8 @@  static void __netif_receive_skb_list(struct list_head *head)
 
 			/* Handle the previous sublist */
 			list_cut_before(&sublist, head, &skb->list);
-			__netif_receive_skb_list_core(&sublist, pfmemalloc);
+			if (!list_empty(&sublist))
+				__netif_receive_skb_list_core(&sublist, pfmemalloc);
 			pfmemalloc = !pfmemalloc;
 			/* See comments in __netif_receive_skb */
 			if (pfmemalloc)
@@ -4309,7 +4310,8 @@  static void __netif_receive_skb_list(struct list_head *head)
 		}
 	}
 	/* Handle the remaining sublist */
-	__netif_receive_skb_list_core(head, pfmemalloc);
+	if (!list_empty(head))
+		__netif_receive_skb_list_core(head, pfmemalloc);
 	/* Restore pflags */
 	if (pfmemalloc)
 		memalloc_noreclaim_restore(noreclaim_flag);
@@ -4426,6 +4428,8 @@  void netif_receive_skb_list(struct list_head *head)
 {
 	struct sk_buff *skb;
 
+	if (list_empty(head))
+		return;
 	list_for_each_entry(skb, head, list)
 		trace_netif_receive_skb_list_entry(skb);
 	netif_receive_skb_list_internal(head);