bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] net: gro: flush the real oldest skb
@ 2021-10-27  8:49 kerneljasonxing
  2021-10-27 13:59 ` Jason Xing
  0 siblings, 1 reply; 2+ messages in thread
From: kerneljasonxing @ 2021-10-27  8:49 UTC (permalink / raw)
  To: davem, kuba, ast, daniel, hawk, john.fastabend, andrii, kafai,
	songliubraving, yhs, kpsingh, edumazet, atenart, alobakin,
	weiwan, bjorn, arnd, memxor
  Cc: netdev, linux-kernel, bpf, kerneljasonxing, Jason Xing

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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH net] net: gro: flush the real oldest skb
  2021-10-27  8:49 [PATCH net] net: gro: flush the real oldest skb kerneljasonxing
@ 2021-10-27 13:59 ` Jason Xing
  0 siblings, 0 replies; 2+ messages in thread
From: Jason Xing @ 2021-10-27 13:59 UTC (permalink / raw)
  To: David Miller, kuba, ast, daniel, hawk, john.fastabend, andrii,
	kafai, songliubraving, yhs, kpsingh, Eric Dumazet, atenart,
	alobakin, Wei Wang, bjorn, arnd, memxor
  Cc: netdev, LKML, bpf, Jason Xing

This patch has some problems. I got wrong with the @skb->list. Please ignore it.

Thanks,
Jason

On Wed, Oct 27, 2021 at 4:50 PM <kerneljasonxing@gmail.com> wrote:
>
> 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
>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-10-27 14:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-27  8:49 [PATCH net] net: gro: flush the real oldest skb kerneljasonxing
2021-10-27 13:59 ` Jason Xing

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).