Skip to content

Commit 8dc1c44

Browse files
edumazetkuba-moo
authored andcommitted
net: gro: do not keep too many GRO packets in napi->rx_list
Commit c807943 ("net: Fix packet reordering caused by GRO and listified RX cooperation") had the unfortunate effect of adding latencies in common workloads. Before the patch, GRO packets were immediately passed to upper stacks. After the patch, we can accumulate quite a lot of GRO packets (depdending on NAPI budget). My fix is counting in napi->rx_count number of segments instead of number of logical packets. Fixes: c807943 ("net: Fix packet reordering caused by GRO and listified RX cooperation") Signed-off-by: Eric Dumazet <[email protected]> Bisected-by: John Sperbeck <[email protected]> Tested-by: Jian Yang <[email protected]> Cc: Maxim Mikityanskiy <[email protected]> Reviewed-by: Saeed Mahameed <[email protected]> Reviewed-by: Edward Cree <[email protected]> Reviewed-by: Alexander Lobakin <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent b3d2c7b commit 8dc1c44

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

net/core/dev.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5735,10 +5735,11 @@ static void gro_normal_list(struct napi_struct *napi)
57355735
/* Queue one GRO_NORMAL SKB up for list processing. If batch size exceeded,
57365736
* pass the whole batch up to the stack.
57375737
*/
5738-
static void gro_normal_one(struct napi_struct *napi, struct sk_buff *skb)
5738+
static void gro_normal_one(struct napi_struct *napi, struct sk_buff *skb, int segs)
57395739
{
57405740
list_add_tail(&skb->list, &napi->rx_list);
5741-
if (++napi->rx_count >= gro_normal_batch)
5741+
napi->rx_count += segs;
5742+
if (napi->rx_count >= gro_normal_batch)
57425743
gro_normal_list(napi);
57435744
}
57445745

@@ -5777,7 +5778,7 @@ static int napi_gro_complete(struct napi_struct *napi, struct sk_buff *skb)
57775778
}
57785779

57795780
out:
5780-
gro_normal_one(napi, skb);
5781+
gro_normal_one(napi, skb, NAPI_GRO_CB(skb)->count);
57815782
return NET_RX_SUCCESS;
57825783
}
57835784

@@ -6067,7 +6068,7 @@ static gro_result_t napi_skb_finish(struct napi_struct *napi,
60676068
{
60686069
switch (ret) {
60696070
case GRO_NORMAL:
6070-
gro_normal_one(napi, skb);
6071+
gro_normal_one(napi, skb, 1);
60716072
break;
60726073

60736074
case GRO_DROP:
@@ -6155,7 +6156,7 @@ static gro_result_t napi_frags_finish(struct napi_struct *napi,
61556156
__skb_push(skb, ETH_HLEN);
61566157
skb->protocol = eth_type_trans(skb, skb->dev);
61576158
if (ret == GRO_NORMAL)
6158-
gro_normal_one(napi, skb);
6159+
gro_normal_one(napi, skb, 1);
61596160
break;
61606161

61616162
case GRO_DROP:

0 commit comments

Comments
 (0)