Skip to content

Commit b9f463d

Browse files
ecree-solarflaredavem330
authored andcommitted
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 <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 5fa1273 commit b9f463d

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

net/core/dev.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4887,7 +4887,8 @@ static void __netif_receive_skb_list(struct list_head *head)
48874887

48884888
/* Handle the previous sublist */
48894889
list_cut_before(&sublist, head, &skb->list);
4890-
__netif_receive_skb_list_core(&sublist, pfmemalloc);
4890+
if (!list_empty(&sublist))
4891+
__netif_receive_skb_list_core(&sublist, pfmemalloc);
48914892
pfmemalloc = !pfmemalloc;
48924893
/* See comments in __netif_receive_skb */
48934894
if (pfmemalloc)
@@ -4897,7 +4898,8 @@ static void __netif_receive_skb_list(struct list_head *head)
48974898
}
48984899
}
48994900
/* Handle the remaining sublist */
4900-
__netif_receive_skb_list_core(head, pfmemalloc);
4901+
if (!list_empty(head))
4902+
__netif_receive_skb_list_core(head, pfmemalloc);
49014903
/* Restore pflags */
49024904
if (pfmemalloc)
49034905
memalloc_noreclaim_restore(noreclaim_flag);
@@ -5058,6 +5060,8 @@ void netif_receive_skb_list(struct list_head *head)
50585060
{
50595061
struct sk_buff *skb;
50605062

5063+
if (list_empty(head))
5064+
return;
50615065
list_for_each_entry(skb, head, list)
50625066
trace_netif_receive_skb_list_entry(skb);
50635067
netif_receive_skb_list_internal(head);

0 commit comments

Comments
 (0)