Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2355841pxb; Fri, 5 Feb 2021 16:13:18 -0800 (PST) X-Google-Smtp-Source: ABdhPJy7/WCs/0Sl+8ZKdj8ezHi0xjtVeOhF8QbLL8mzGTzJrx9MnlsUGOHHAvr++ZzV6s1LVsng X-Received: by 2002:a17:906:2ac1:: with SMTP id m1mr6363876eje.149.1612570398184; Fri, 05 Feb 2021 16:13:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612570398; cv=none; d=google.com; s=arc-20160816; b=EVsW5tV97U5BMbzfRkRTQmoasPF+EJgejcK1xcH97yctqfgl4YtReKeJIrsWKQWkk9 jTjSHlgUqnK2P3VEnhjL4vi76L3afaGBP6CIltdzoGKoqTG+RxqQwfSUTFvWcyDX6o80 hqKI1mexB+gTJS4XlxUaxv7d/p5GvUDlQdBSKsvG5nySH6tMk84I0N6vf9nGCiX2TOOT RjuUD08UL4sOOMRb7kRTbCqxqPor/MdPTbDh4O/cbBHhGV7gXFiqwpxFJrmA7FWbzKnZ eUFN4x+2DsWPfl61q+Vgf7ZfSHkAX35MUMKV4pNqsLy9iLZli/hTBc7RxXke8EPpGECV mvdQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:reply-to:cc:from:to :dkim-signature:date; bh=3j2lZ80aPDVQbBRbqSe5SVXT7GRlnN8V+70zH4XgnmM=; b=c9wjmNDgys1KSKZdRjJA4N7tWdOLN8UhZ2yTm7pPwizjSCkokwSteG6twAVizyGsrl FGHSYHFPz8A4zG97VRrOMpAa216S/27z2nvrhh1t63t7RYtP8mlQRTh8eX/W5ci6Etrr cJyswLsbLDyKMV0XzOB/ytaSxDwaL8pOU8wDSLTEV93zQHeHGA7IqC6jLL3U/kbEopXS Gl9PSlGLZ22D4v1qecW602inV6SoznOLkEnrqwvNDF4efnYSsfzNOz+M/gxJQSeIMTIY PyitevjDChThyy9558Hu1o6vRbdwiqz3gzpANrnPVQVydrry+ChEWxF3rK9JOzAZODou 4myw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@pm.me header.s=protonmail header.b=H9hZFvGT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=pm.me Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x18si6815518ejd.80.2021.02.05.16.12.53; Fri, 05 Feb 2021 16:13:18 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@pm.me header.s=protonmail header.b=H9hZFvGT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=pm.me Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231614AbhBFAK7 (ORCPT + 99 others); Fri, 5 Feb 2021 19:10:59 -0500 Received: from mail-03.mail-europe.com ([91.134.188.129]:41628 "EHLO mail-03.mail-europe.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229843AbhBENIb (ORCPT ); Fri, 5 Feb 2021 08:08:31 -0500 Date: Fri, 05 Feb 2021 13:03:19 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pm.me; s=protonmail; t=1612530205; bh=3j2lZ80aPDVQbBRbqSe5SVXT7GRlnN8V+70zH4XgnmM=; h=Date:To:From:Cc:Reply-To:Subject:In-Reply-To:References:From; b=H9hZFvGT+/344ukLx5zy3I4NISCOySc0Ws1ms2hJdrnqrYiLjy6zcTNZKPj7zwTnU YD6VaGXQJVW5BcsGWU+iuw/Na/HotIZNLsLy5pDQLSOLu6SHPbcBC7x+Ab/LSAfIq4 06mQkqj+H+gVk9V98PtID5ofbe70FNZRxDrajglGNf6EhBeCMRWSzkErmbkB8VhkeH i8uM+RzswqcU4BtWcIKFMN39GNpk+yEoETpXglw4s3TT8+vcmUiiU7MYkpBHif4Qpp 2nNRBhT/l593T0p8PDSqIoB33zapVODlGnQipF6Wg5lph3El9/FMjAKy5xH/J5r/rf oFYqgz3STfVlQ== To: Eric Dumazet From: Alexander Lobakin Cc: Alexander Lobakin , Saeed Mahameed , Eric Dumazet , "David S. Miller" , Jakub Kicinski , John Sperbeck , Jian Yang , Maxim Mikityanskiy , Saeed Mahameed , Edward Cree , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Reply-To: Alexander Lobakin Subject: Re: [PATCH net] net: gro: do not keep too many GRO packets in napi->rx_list Message-ID: <20210205130238.5741-1-alobakin@pm.me> In-Reply-To: References: <20210204213146.4192368-1-eric.dumazet@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-1.2 required=10.0 tests=ALL_TRUSTED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF shortcircuit=no autolearn=disabled version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on mailout.protonmail.ch Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Eric Dumazet Date: Thu, 4 Feb 2021 23:44:17 +0100 > On Thu, Feb 4, 2021 at 11:14 PM Saeed Mahameed wrote: > > > > On Thu, 2021-02-04 at 13:31 -0800, Eric Dumazet wrote: > > > From: Eric Dumazet > > > > > > Commit c80794323e82 ("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). > > > > > > > Why napi budget ? looking at the code it seems to be more related to > > MAX_GRO_SKBS * gro_normal_batch, since we are counting GRO SKBs as 1 > > > Simply because we call gro_normal_list() from napi_poll(), > > So we flush the napi rx_list every 64 packets under stress.(assuming > NIC driver uses NAPI_POLL_WEIGHT), > or more often if napi_complete_done() is called if the budget was not exh= austed. Saeed, Eric means that if we have e.g. 8 GRO packets with 8 segs each, then rx_list will be flushed only after processing of 64 ingress frames. > GRO always has been able to keep MAX_GRO_SKBS in its layer, but no recent= patch > has changed this part. > > > > > > > > but maybe i am missing some information about the actual issue you are > > hitting. > > > Well, the issue is precisely described in the changelog. > > > > > > > > My fix is counting in napi->rx_count number of segments > > > instead of number of logical packets. > > > > > > Fixes: c80794323e82 ("net: Fix packet reordering caused by GRO and > > > listified RX cooperation") > > > Signed-off-by: Eric Dumazet > > > Bisected-by: John Sperbeck > > > Tested-by: Jian Yang > > > Cc: Maxim Mikityanskiy > > > Cc: Alexander Lobakin It's strange why mailmap didn't pick up my active email at pm.me. Anyways, this fix is correct for me. It restores the original Edward's logics, but without spurious out-of-order deliveries. Moreover, the pre-patch behaviour can easily be achieved by increasing net.core.gro_normal_batch if needed. Thanks! Reviewed-by: Alexander Lobakin > > > Cc: Saeed Mahameed > > > Cc: Edward Cree > > > --- > > > net/core/dev.c | 11 ++++++----- > > > 1 file changed, 6 insertions(+), 5 deletions(-) > > > > > > diff --git a/net/core/dev.c b/net/core/dev.c > > > index > > > a979b86dbacda9dfe31dd8b269024f7f0f5a8ef1..449b45b843d40ece7dd1e2ed6a5 > > > 996ee1db9f591 100644 > > > --- a/net/core/dev.c > > > +++ b/net/core/dev.c > > > @@ -5735,10 +5735,11 @@ static void gro_normal_list(struct > > > napi_struct *napi) > > > /* Queue one GRO_NORMAL SKB up for list processing. If batch size > > > exceeded, > > > * pass the whole batch up to the stack. > > > */ > > > -static void gro_normal_one(struct napi_struct *napi, struct sk_buff > > > *skb) > > > +static void gro_normal_one(struct napi_struct *napi, struct sk_buff > > > *skb, int segs) > > > { > > > list_add_tail(&skb->list, &napi->rx_list); > > > - if (++napi->rx_count >=3D gro_normal_batch) > > > + napi->rx_count +=3D segs; > > > + if (napi->rx_count >=3D gro_normal_batch) > > > gro_normal_list(napi); > > > } > > > > > > @@ -5777,7 +5778,7 @@ static int napi_gro_complete(struct napi_struct > > > *napi, struct sk_buff *skb) > > > } > > > > > > out: > > > - gro_normal_one(napi, skb); > > > + gro_normal_one(napi, skb, NAPI_GRO_CB(skb)->count); > > > > Seems correct to me, > > > > Reviewed-by: Saeed Mahameed Al