Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp5074400pxb; Mon, 15 Feb 2021 08:50:50 -0800 (PST) X-Google-Smtp-Source: ABdhPJzArJz0F5DfeBGFJEFK2tD6lqlNkG3Fd/GyCVzDZV6dp8y/8EbkJ+Tj1fG2CHX+795xcPx8 X-Received: by 2002:a05:6402:c8e:: with SMTP id cm14mr16635183edb.6.1613407850158; Mon, 15 Feb 2021 08:50:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613407850; cv=none; d=google.com; s=arc-20160816; b=MhnKL5kbiwIWkBNPKzdskTFgc+cNUr4RkdUdNzlzTABlSdqtQB6LXEbA60QR/ZYs/z Ipp6gryJCjkwXD+4Q/Pl8RH06lK+1BlIQB05jMMT9OUTmeSeid8UaF5Qnu49E2M+1Lnw 8hZ+9hhrg+4KO7Gh6wNG9ztJoo2wIl2tcJYfS2V25y3qoyhuph56I1zK2Y5d51KgwTw1 BbC7fdsZHTV+wrSJK8iuz1Zwl28VR3s5YYpoZ9iD3jkpatv3BGG0hy7OWN3R0WvQLLSo Vp0JbrOA1Igvd18LdtrJS0ZSAkDm/h+6vR9JI84L/hETXnMma3mfSBLW+GtkXjfgXQWx bGHw== 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=xfPKBORaEWarhEev9cd0K4xyCIjH4tThoNNBFTPeObE=; b=iOUXOm9qEJbqQP0mjF/Gtq7EMRinXG/eRBAJCAnAR8AipjOva5FHZzEP7h/KdNytwZ CVHnEzjENxYFOlrl/AoYoz67v46toOnjfQPFDoSBmjR1tRdZzo1Eohuzdj918/z+ZnCn uG7uUH8Yuw4KG4MpxfEHC5oWWenK71THneU2IdAi+TWomOXnP0zWqRSPKdDf9nitH/+6 fffiF1coA0G0P+re4iVL1M6gPe+NV7EzzXDUyHM8Dg75kHY4xuzEZXGJDCpH+7/XkUOb 6suIJ9hfPC46Nz/EFFhI0JVrKkSy10reCnIPT4loR6sUcIcFXKa7o3z/NWxR17NO2N0s +mCg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=A0gMubGA; 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 j9si7849498ejc.261.2021.02.15.08.50.27; Mon, 15 Feb 2021 08:50:50 -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=A0gMubGA; 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 S231623AbhBOQrb (ORCPT + 99 others); Mon, 15 Feb 2021 11:47:31 -0500 Received: from mail.kernel.org ([198.145.29.99]:50210 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230392AbhBOPiL (ORCPT ); Mon, 15 Feb 2021 10:38:11 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id C60A664EF1; Mon, 15 Feb 2021 15:34:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1613403268; bh=bZA6qMxGaBqMadWmdQSrmd9KSoH9VnCZsx1IowzvLZ0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=A0gMubGA9fM09y54Rr9AE2B7v3wcPCyUr5nG3SgI2mHOjAsF93TVxcv4a5mmejffQ 3kq9Cd2eMFZM+Vk9t8WAtJsyJjWaWHbUoVHTYL11GMzxH7UbX9sc370qDgWOB5MiKX zZexcx8QmWFGnYVuVPZ2Jf+BaKuPkLfPr96OIXmE= 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.10 092/104] net: gro: do not keep too many GRO packets in napi->rx_list Date: Mon, 15 Feb 2021 16:27:45 +0100 Message-Id: <20210215152722.427768568@linuxfoundation.org> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210215152719.459796636@linuxfoundation.org> References: <20210215152719.459796636@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 @@ -5723,10 +5723,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); } @@ -5765,7 +5766,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; } @@ -6055,7 +6056,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: @@ -6143,7 +6144,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: