Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp879588pxb; Wed, 27 Oct 2021 14:20:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwQ8TXmJs/j/kViWDq2+b6J7dR3qcnfDD+PmQFd/w7cmO1jHyTofSxDRrUnlHuJc4pERu/e X-Received: by 2002:aa7:c6c1:: with SMTP id b1mr427621eds.11.1635369643886; Wed, 27 Oct 2021 14:20:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635369643; cv=none; d=google.com; s=arc-20160816; b=JAaMVv8ssjWAU7ecOyX6wixHxHZM9J/ZpAZtY6xsbvAu8rO29/uo2hM8LutIwcaiTr 92MXkafV23SlIC/JslWrCBgss/zRNzAArsVPB+tCNMKWNhX/+GsT4rZpaYJe71Vzaei2 YVrrb0CB056mKVpLcKFFLjGDN0G4g45MQ3AmaYVMe0SpmAJjQRMSnka0MI82gVXlVU8v LiFhq3gr0fsAlMS7P7YiL0bZ9eKFaErd0yVGgeBIp5pC80kqofph3rV1jLK1t7zHbFs5 CpKUafn/uBd9AQikWQOu+PlEWFU0so1Qf7ik1HBKARQY6ATrS5x7gM600m/NGdwrG7r3 XqdA== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=z5P3/alhJ1He0txyAzdck7/7d56+F/fzpzqghGnxQS8=; b=IFR5chKqxOPDvKJCTYHOrYx/2YvUW8bL8tOZ6+W068l+j4V9qwfKWwrcPCfPDC4QO2 XWLQ7vtbbGsXG+xiUpLHJXo6Yf5tPNmIyjJCcRzRN8geSY1sgUJFfpJYJayOTShl5N7U 93PiMCjRHq+50hmxoJxtMYrx857FDQ5wYhKa2UF6Jgv2Z/aMQyubGAlAnm4T/61UFFza sSqlp9fbc/HKov9XZXfnOMpyHp8nJyfgNxBDp2N8aOw3VTR1qvas6q0w2yz2srZSM985 +2BpWOsLr7P9qXR09UxCuELwbO6ZhxiqNBGRESdAgRrXLqS9IKQfUnhlsRJ+S0151eQg rffA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=LrKScxu+; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id nc8si1641657ejc.776.2021.10.27.14.20.20; Wed, 27 Oct 2021 14:20:43 -0700 (PDT) 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=@gmail.com header.s=20210112 header.b=LrKScxu+; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241023AbhJ0Iwp (ORCPT + 97 others); Wed, 27 Oct 2021 04:52:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50490 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239598AbhJ0Iwn (ORCPT ); Wed, 27 Oct 2021 04:52:43 -0400 Received: from mail-pj1-x102e.google.com (mail-pj1-x102e.google.com [IPv6:2607:f8b0:4864:20::102e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 04E5CC061570; Wed, 27 Oct 2021 01:50:19 -0700 (PDT) Received: by mail-pj1-x102e.google.com with SMTP id v1-20020a17090a088100b001a21156830bso4552864pjc.1; Wed, 27 Oct 2021 01:50:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=z5P3/alhJ1He0txyAzdck7/7d56+F/fzpzqghGnxQS8=; b=LrKScxu+Cucp9+VA8Fh1unPAtj/7zshPQgCWMkw5J8oT3efw8cbN3c4ai6VVR2qjpN yi6ZsVIyNWPig9umy3cp+99AlFO8qdLWV76TLgGeIeNWF3/tRQ2zYnfRmC+2+UURRejG SDtEQBMVHahz19Qr9pBqom8ZsBXt6Dl4yvS6cCvTtGQ2EoBnGUXTEiAaCT8pHI5cU2+B o6kaXpWDRsIthluNLtBQKcWa4saLe8syRy3lfJU7+9Z1iWLo6g7lDzDzQPVk85QvNQPr jULjI5hyjQKElSFa10vOV/3lzFpgefXX2q7ZVspwunbi53TxLhvc92tsXfz6DqIQA5yr SFcw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=z5P3/alhJ1He0txyAzdck7/7d56+F/fzpzqghGnxQS8=; b=vOxH9e/D1VXFd+vhKvGXidFk9KafLdIa3V355hHpkX13EVs1CUXrsrlvuOl9aRyY2f KKQnbq9GT0Kxn0S6v6quoxQG9up0Nk0ISOU+wJMmvlDipylkYgcKCN9XlnECtyKtprKZ 9AAFRmo0EWeQRai0stJ7YpG3cob4BzPlt8w1SJf6HE/L6rbjn4FEWc7BfrtthFZ7Trve z4M+eeJquGYGcU1IwoGTa+2KePohi0zjeJuP1lKYwN/hAw51lcsnsdh442B0VahIfWre 9b9djxrAdIl+G3A6Ll7j1o4VBn66/CW3NLzDne4HpNzRZi5kTYDfyzeirMEXD3Qyof7p xwQA== X-Gm-Message-State: AOAM5326cX91tBDlKOiKtlGYJXO17AuXJkgwKw6J6TZWtriilTQxbwYx wnLBGwaCPIomAcU4tKeNG7o= X-Received: by 2002:a17:902:a70a:b0:140:44f9:6d75 with SMTP id w10-20020a170902a70a00b0014044f96d75mr19675029plq.58.1635324618570; Wed, 27 Oct 2021 01:50:18 -0700 (PDT) Received: from localhost.localdomain ([154.86.159.246]) by smtp.gmail.com with ESMTPSA id bg15sm3401055pjb.15.2021.10.27.01.50.12 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 27 Oct 2021 01:50:18 -0700 (PDT) From: kerneljasonxing@gmail.com To: davem@davemloft.net, kuba@kernel.org, ast@kernel.org, daniel@iogearbox.net, hawk@kernel.org, john.fastabend@gmail.com, andrii@kernel.org, kafai@fb.com, songliubraving@fb.com, yhs@fb.com, kpsingh@kernel.org, edumazet@google.com, atenart@kernel.org, alobakin@pm.me, weiwan@google.com, bjorn@kernel.org, arnd@arndb.de, memxor@gmail.com Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, bpf@vger.kernel.org, kerneljasonxing@gmail.com, Jason Xing Subject: [PATCH net] net: gro: flush the real oldest skb Date: Wed, 27 Oct 2021 16:49:44 +0800 Message-Id: <20211027084944.4508-1-kerneljasonxing@gmail.com> X-Mailer: git-send-email 2.30.1 (Apple Git-130) MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jason Xing Prior to this patch, when the count of skbs of one flow is larger than MAX_GRO_SKBS, gro_flush_oldest() flushes the tail of the list. However, as we can see in the merge part of skb_gro_receive(), the tail of the list is the newest, head oldest. Here, we need to fetch the real oldest one and then process it to lower the latency. Fix: 07d78363dc ("net: Convert NAPI gro list into a small hash table.") Signed-off-by: Jason Xing --- net/core/dev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/core/dev.c b/net/core/dev.c index 7ee9fec..d52ebdb 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -6012,7 +6012,7 @@ static void gro_flush_oldest(struct napi_struct *napi, struct list_head *head) { struct sk_buff *oldest; - oldest = list_last_entry(head, struct sk_buff, list); + oldest = list_first_entry(head, struct sk_buff, list); /* We are called with head length >= MAX_GRO_SKBS, so this is * impossible. -- 1.8.3.1