From mboxrd@z Thu Jan 1 00:00:00 1970 From: Edward Cree Subject: [PATCH v4 net-next 9/9] net: don't bother calling list RX functions on empty lists Date: Mon, 2 Jul 2018 16:14:44 +0100 Message-ID: <3c1622e7-8b8e-5dbe-47d9-a28ad14b2942@solarflare.com> References: <5bf84d99-8f77-54ee-7543-ada13a730361@solarflare.com> Mime-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Cc: To: Return-path: Received: from dispatch1-us1.ppe-hosted.com ([67.231.154.164]:45536 "EHLO dispatch1-us1.ppe-hosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752212AbeGBPOt (ORCPT ); Mon, 2 Jul 2018 11:14:49 -0400 In-Reply-To: <5bf84d99-8f77-54ee-7543-ada13a730361@solarflare.com> Content-Language: en-GB Sender: netdev-owner@vger.kernel.org List-ID: Generally the check should be very cheap, as the sk_buff_head is in cache. Signed-off-by: Edward Cree --- net/core/dev.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/net/core/dev.c b/net/core/dev.c index 4c5ebfab9bc8..d6084b0cd9ce 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -4773,7 +4773,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) @@ -4783,7 +4784,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); @@ -4944,6 +4946,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);