bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
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 <xingwanli@kuaishou.com>
Subject: [PATCH net] net: gro: flush the real oldest skb
Date: Wed, 27 Oct 2021 16:49:44 +0800	[thread overview]
Message-ID: <20211027084944.4508-1-kerneljasonxing@gmail.com> (raw)

From: Jason Xing <xingwanli@kuaishou.com>

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 <xingwanli@kuaishou.com>
---
 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


             reply	other threads:[~2021-10-27  8:50 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-27  8:49 kerneljasonxing [this message]
2021-10-27 13:59 ` [PATCH net] net: gro: flush the real oldest skb Jason Xing

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211027084944.4508-1-kerneljasonxing@gmail.com \
    --to=kerneljasonxing@gmail.com \
    --cc=alobakin@pm.me \
    --cc=andrii@kernel.org \
    --cc=arnd@arndb.de \
    --cc=ast@kernel.org \
    --cc=atenart@kernel.org \
    --cc=bjorn@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=hawk@kernel.org \
    --cc=john.fastabend@gmail.com \
    --cc=kafai@fb.com \
    --cc=kpsingh@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=memxor@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=songliubraving@fb.com \
    --cc=weiwan@google.com \
    --cc=xingwanli@kuaishou.com \
    --cc=yhs@fb.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).