Skip to contentSkip to conversation

net: gro: flush the real oldest skb

PATCH In review [email protected] 1 participant 2 messages Oct 27, 2021

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: gro: flush the real oldest skb

From: Jason Xing <[email protected]>

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

---
 net/core/dev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/core/dev.c +1 -1
index 7ee9fec..d52ebdb 100644
@@ -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.
Signature · 1 line
1.8.3.1
author
#1 lore raw

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

Thanks,
Jason

Quoted 33 lines · On Wed, Oct 27, 2021 at 4:50 PM <[email protected]> wrote:

From: Jason Xing <[email protected]>

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

---
 net/core/dev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/core/dev.c +1 -2
index 7ee9fec..d52ebdb 100644
@@ -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