Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp5039699pxb; Mon, 15 Feb 2021 08:01:56 -0800 (PST) X-Google-Smtp-Source: ABdhPJxcSpAxHyHT57z0PumK6QL2GyL5s3+ZYqo2ogRYiZHf1B+YZWQ2tTcpOZskE8AMgBqpIxmZ X-Received: by 2002:a17:907:2710:: with SMTP id w16mr16550177ejk.73.1613404915760; Mon, 15 Feb 2021 08:01:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613404915; cv=none; d=google.com; s=arc-20160816; b=iknVKW70vmHISPI3JQNblwpEyCRkYa4touQprZGP6L+TrIbIFkeAqnM61OCTdN+S7N k4dwXZFUFn22MpWq0Cg6HhZWO2CyTabR3xzD/nlYhwv8D1anZU6hOHJUA9La1Qmf2KoP KJPvPifUuhKPe1t03Z6bLMeofZZD0S9zjaCqcLvzgwtXBLuDFcPk9cDIr7urkXtr9gjG ihJCde5a8H3UFhcNmeQnaE4zdM5ICkk8k4Qm9rRSvKnp0fZtFBDe5666SV4e10bd+isn qzofIhT3Px2S1DHNh0Ng6rc873KofWTs7AlXhAKHSx+N1IYMxMZ06jtdu1FxoAHSWCdm f4uw== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=nti7sDNHKggiawOQN2s9gl4Ntj2pLTPxnPNpbnswZjY=; b=uRTM454YS8ARKnWEjzmjwWPkoYHBSI2bvxEWrCOAFxnfs0IWc9V1Ka1BbG886glIAI Pmyb0TQJ/a2SEFaPWbcB8NWCPffh0Gm4sqDGD6/Rje4pFP8SMVn/IdJuBh+2sFS6OtRb 9vIQ6M9xDApuSqg50WMeWiEtixrmZgYhMlp35JfayJpGMdz8jIUHp4d+aPjSGefgn+v1 30YDD5s/BogsQ0WE08azrtQP+Zqz9rl7gG8ut/0M9sg3Jrsedwv+jwVzsTdEa1Wf4hFa p4qJwfAqTwep/vXRivZyDS1/Fs5rH9WM19OcHuEOwktr1N8mo6qXWTE33CXcfBTfoG2p Wcvw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=tXZD6qNk; 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=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f25si7925331ejq.58.2021.02.15.08.01.31; Mon, 15 Feb 2021 08:01:55 -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=@linuxfoundation.org header.s=korg header.b=tXZD6qNk; 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=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231996AbhBOQAY (ORCPT + 99 others); Mon, 15 Feb 2021 11:00:24 -0500 Received: from mail.kernel.org ([198.145.29.99]:46916 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231224AbhBOPdE (ORCPT ); Mon, 15 Feb 2021 10:33:04 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 09E6564EB1; Mon, 15 Feb 2021 15:30:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1613403030; bh=j1nNR3ryxJs6LxaHt8kb1VfQ/3ogQuet5q+d/qNmY1E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tXZD6qNkLILziRPL/LtRMwZIWb/4wu/aY8slnuAn3eDz5Ntk+t3XTIn54TekwqkhD fscvi0NwliysyUbu+NPZDDwHZ8YyNt+4La3PAIvzSJTM/h/WQQX+BE+Oj3CEfKt1fG lI49z1aSrOtIBdDsnJnqEUUNMtcsRErEoLWkHFsg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Eric Dumazet , Jian Yang , Maxim Mikityanskiy , Saeed Mahameed , Edward Cree , Alexander Lobakin , Jakub Kicinski , John Sperbeck Subject: [PATCH 5.4 52/60] net: gro: do not keep too many GRO packets in napi->rx_list Date: Mon, 15 Feb 2021 16:27:40 +0100 Message-Id: <20210215152717.045112340@linuxfoundation.org> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210215152715.401453874@linuxfoundation.org> References: <20210215152715.401453874@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Eric Dumazet commit 8dc1c444df193701910f5e80b5d4caaf705a8fb0 upstream. 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). 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 Reviewed-by: Saeed Mahameed Reviewed-by: Edward Cree Reviewed-by: Alexander Lobakin Link: https://lore.kernel.org/r/20210204213146.4192368-1-eric.dumazet@gmail.com Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman --- net/core/dev.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) --- a/net/core/dev.c +++ b/net/core/dev.c @@ -5275,10 +5275,11 @@ static void gro_normal_list(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 >= gro_normal_batch) + napi->rx_count += segs; + if (napi->rx_count >= gro_normal_batch) gro_normal_list(napi); } @@ -5317,7 +5318,7 @@ static int napi_gro_complete(struct napi } out: - gro_normal_one(napi, skb); + gro_normal_one(napi, skb, NAPI_GRO_CB(skb)->count); return NET_RX_SUCCESS; } @@ -5608,7 +5609,7 @@ static gro_result_t napi_skb_finish(stru { switch (ret) { case GRO_NORMAL: - gro_normal_one(napi, skb); + gro_normal_one(napi, skb, 1); break; case GRO_DROP: @@ -5696,7 +5697,7 @@ static gro_result_t napi_frags_finish(st __skb_push(skb, ETH_HLEN); skb->protocol = eth_type_trans(skb, skb->dev); if (ret == GRO_NORMAL) - gro_normal_one(napi, skb); + gro_normal_one(napi, skb, 1); break; case GRO_DROP: