Skip to content

Commit

Permalink
net: don't bother calling list RX functions on empty lists
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Edward Cree authored and David S. Miller committed Jul 4, 2018
1 parent 5fa1273 commit b9f463d
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions net/core/dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -4887,7 +4887,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)
Expand All @@ -4897,7 +4898,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);
Expand Down Expand Up @@ -5058,6 +5060,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);
Expand Down

0 comments on commit b9f463d

Please sign in to comment.