netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH][net-next][v2] net: limit each hash list length to MAX_GRO_SKBS
@ 2018-07-05  6:34 Li RongQing
  2018-07-05 10:20 ` David Miller
  0 siblings, 1 reply; 5+ messages in thread
From: Li RongQing @ 2018-07-05  6:34 UTC (permalink / raw)
  To: netdev

After commit 07d78363dcff ("net: Convert NAPI gro list into a small hash
table.")' there is 8 hash buckets, which allows more flows to be held for
merging.  but MAX_GRO_SKBS, the total held skb for merging, is 8 skb still,
limit the hash table performance.

keep MAX_GRO_SKBS as 8 skb, but limit each hash list length to 8 skb, not
the total 8 skb

Signed-off-by: Li RongQing <lirongqing@baidu.com>
---
 include/linux/netdevice.h |  7 +++++-
 net/core/dev.c            | 56 +++++++++++++++++++----------------------------
 2 files changed, 29 insertions(+), 34 deletions(-)

diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 8bf8d6149f79..3b60ac51ddba 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -302,6 +302,11 @@ struct netdev_boot_setup {
 
 int __init netdev_boot_setup(char *str);
 
+struct gro_list {
+	struct list_head	list;
+	int			count;
+};
+
 /*
  * Structure for NAPI scheduling similar to tasklet but with weighting
  */
@@ -323,7 +328,7 @@ struct napi_struct {
 	int			poll_owner;
 #endif
 	struct net_device	*dev;
-	struct list_head	gro_hash[GRO_HASH_BUCKETS];
+	struct gro_list		gro_hash[GRO_HASH_BUCKETS];
 	struct sk_buff		*skb;
 	struct hrtimer		timer;
 	struct list_head	dev_list;
diff --git a/net/core/dev.c b/net/core/dev.c
index 08d58e0debe5..38c58e32f5bc 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -149,7 +149,6 @@
 
 #include "net-sysfs.h"
 
-/* Instead of increasing this, you should create a hash table. */
 #define MAX_GRO_SKBS 8
 
 /* This should be increased if a protocol with a bigger head is added. */
@@ -4989,9 +4988,10 @@ static int napi_gro_complete(struct sk_buff *skb)
 	return netif_receive_skb_internal(skb);
 }
 
-static void __napi_gro_flush_chain(struct napi_struct *napi, struct list_head *head,
+static void __napi_gro_flush_chain(struct napi_struct *napi, u32 index,
 				   bool flush_old)
 {
+	struct list_head *head = &napi->gro_hash[index].list;
 	struct sk_buff *skb, *p;
 
 	list_for_each_entry_safe_reverse(skb, p, head, list) {
@@ -5000,22 +5000,20 @@ static void __napi_gro_flush_chain(struct napi_struct *napi, struct list_head *h
 		list_del_init(&skb->list);
 		napi_gro_complete(skb);
 		napi->gro_count--;
+		napi->gro_hash[index].count--;
 	}
 }
 
-/* napi->gro_hash contains packets ordered by age.
+/* napi->gro_hash[].list contains packets ordered by age.
  * youngest packets at the head of it.
  * Complete skbs in reverse order to reduce latencies.
  */
 void napi_gro_flush(struct napi_struct *napi, bool flush_old)
 {
-	int i;
-
-	for (i = 0; i < GRO_HASH_BUCKETS; i++) {
-		struct list_head *head = &napi->gro_hash[i];
+	u32 i;
 
-		__napi_gro_flush_chain(napi, head, flush_old);
-	}
+	for (i = 0; i < GRO_HASH_BUCKETS; i++)
+		__napi_gro_flush_chain(napi, i, flush_old);
 }
 EXPORT_SYMBOL(napi_gro_flush);
 
@@ -5027,7 +5025,7 @@ static struct list_head *gro_list_prepare(struct napi_struct *napi,
 	struct list_head *head;
 	struct sk_buff *p;
 
-	head = &napi->gro_hash[hash & (GRO_HASH_BUCKETS - 1)];
+	head = &napi->gro_hash[hash & (GRO_HASH_BUCKETS - 1)].list;
 	list_for_each_entry(p, head, list) {
 		unsigned long diffs;
 
@@ -5095,27 +5093,13 @@ static void gro_pull_from_frag0(struct sk_buff *skb, int grow)
 	}
 }
 
-static void gro_flush_oldest(struct napi_struct *napi)
+static void gro_flush_oldest(struct list_head *head)
 {
-	struct sk_buff *oldest = NULL;
-	unsigned long age = jiffies;
-	int i;
-
-	for (i = 0; i < GRO_HASH_BUCKETS; i++) {
-		struct list_head *head = &napi->gro_hash[i];
-		struct sk_buff *skb;
-
-		if (list_empty(head))
-			continue;
+	struct sk_buff *oldest;
 
-		skb = list_last_entry(head, struct sk_buff, list);
-		if (!oldest || time_before(NAPI_GRO_CB(skb)->age, age)) {
-			oldest = skb;
-			age = NAPI_GRO_CB(skb)->age;
-		}
-	}
+	oldest = list_last_entry(head, struct sk_buff, list);
 
-	/* We are called with napi->gro_count >= MAX_GRO_SKBS, so this is
+	/* We are called with head length >= MAX_GRO_SKBS, so this is
 	 * impossible.
 	 */
 	if (WARN_ON_ONCE(!oldest))
@@ -5130,6 +5114,7 @@ static void gro_flush_oldest(struct napi_struct *napi)
 
 static enum gro_result dev_gro_receive(struct napi_struct *napi, struct sk_buff *skb)
 {
+	u32 hash = skb_get_hash_raw(skb) & (GRO_HASH_BUCKETS - 1);
 	struct list_head *head = &offload_base;
 	struct packet_offload *ptype;
 	__be16 type = skb->protocol;
@@ -5196,6 +5181,7 @@ static enum gro_result dev_gro_receive(struct napi_struct *napi, struct sk_buff
 		list_del_init(&pp->list);
 		napi_gro_complete(pp);
 		napi->gro_count--;
+		napi->gro_hash[hash].count--;
 	}
 
 	if (same_flow)
@@ -5204,10 +5190,11 @@ static enum gro_result dev_gro_receive(struct napi_struct *napi, struct sk_buff
 	if (NAPI_GRO_CB(skb)->flush)
 		goto normal;
 
-	if (unlikely(napi->gro_count >= MAX_GRO_SKBS)) {
-		gro_flush_oldest(napi);
+	if (unlikely(napi->gro_hash[hash].count >= MAX_GRO_SKBS)) {
+		gro_flush_oldest(gro_head);
 	} else {
 		napi->gro_count++;
+		napi->gro_hash[hash].count++;
 	}
 	NAPI_GRO_CB(skb)->count = 1;
 	NAPI_GRO_CB(skb)->age = jiffies;
@@ -5844,8 +5831,10 @@ void netif_napi_add(struct net_device *dev, struct napi_struct *napi,
 	hrtimer_init(&napi->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL_PINNED);
 	napi->timer.function = napi_watchdog;
 	napi->gro_count = 0;
-	for (i = 0; i < GRO_HASH_BUCKETS; i++)
-		INIT_LIST_HEAD(&napi->gro_hash[i]);
+	for (i = 0; i < GRO_HASH_BUCKETS; i++) {
+		INIT_LIST_HEAD(&napi->gro_hash[i].list);
+		napi->gro_hash[i].count = 0;
+	}
 	napi->skb = NULL;
 	napi->poll = poll;
 	if (weight > NAPI_POLL_WEIGHT)
@@ -5885,8 +5874,9 @@ static void flush_gro_hash(struct napi_struct *napi)
 	for (i = 0; i < GRO_HASH_BUCKETS; i++) {
 		struct sk_buff *skb, *n;
 
-		list_for_each_entry_safe(skb, n, &napi->gro_hash[i], list)
+		list_for_each_entry_safe(skb, n, &napi->gro_hash[i].list, list)
 			kfree_skb(skb);
+		napi->gro_hash[i].count = 0;
 	}
 }
 
-- 
2.16.2

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

* Re: [PATCH][net-next][v2] net: limit each hash list length to MAX_GRO_SKBS
  2018-07-05  6:34 [PATCH][net-next][v2] net: limit each hash list length to MAX_GRO_SKBS Li RongQing
@ 2018-07-05 10:20 ` David Miller
  2018-07-08  0:22   ` Eric Dumazet
  0 siblings, 1 reply; 5+ messages in thread
From: David Miller @ 2018-07-05 10:20 UTC (permalink / raw)
  To: lirongqing; +Cc: netdev

From: Li RongQing <lirongqing@baidu.com>
Date: Thu,  5 Jul 2018 14:34:32 +0800

> After commit 07d78363dcff ("net: Convert NAPI gro list into a small hash
> table.")' there is 8 hash buckets, which allows more flows to be held for
> merging.  but MAX_GRO_SKBS, the total held skb for merging, is 8 skb still,
> limit the hash table performance.
> 
> keep MAX_GRO_SKBS as 8 skb, but limit each hash list length to 8 skb, not
> the total 8 skb
> 
> Signed-off-by: Li RongQing <lirongqing@baidu.com>

Applied, thanks.

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

* Re: [PATCH][net-next][v2] net: limit each hash list length to MAX_GRO_SKBS
  2018-07-05 10:20 ` David Miller
@ 2018-07-08  0:22   ` Eric Dumazet
  2018-07-08  1:32     ` David Miller
  2018-07-10 10:59     ` 答复: " Li,Rongqing
  0 siblings, 2 replies; 5+ messages in thread
From: Eric Dumazet @ 2018-07-08  0:22 UTC (permalink / raw)
  To: David Miller, lirongqing; +Cc: netdev



On 07/05/2018 03:20 AM, David Miller wrote:
> From: Li RongQing <lirongqing@baidu.com>
> Date: Thu,  5 Jul 2018 14:34:32 +0800
> 
>> After commit 07d78363dcff ("net: Convert NAPI gro list into a small hash
>> table.")' there is 8 hash buckets, which allows more flows to be held for
>> merging.  but MAX_GRO_SKBS, the total held skb for merging, is 8 skb still,
>> limit the hash table performance.
>>
>> keep MAX_GRO_SKBS as 8 skb, but limit each hash list length to 8 skb, not
>> the total 8 skb
>>
>> Signed-off-by: Li RongQing <lirongqing@baidu.com>
> 
> Applied, thanks.
> 

Maybe gro_count should be replaced by a bitmask, so that we can speed up
napi_gro_flush(), since it now has to use 3 cache lines (gro_hash[] size is 192 bytes)

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

* Re: [PATCH][net-next][v2] net: limit each hash list length to MAX_GRO_SKBS
  2018-07-08  0:22   ` Eric Dumazet
@ 2018-07-08  1:32     ` David Miller
  2018-07-10 10:59     ` 答复: " Li,Rongqing
  1 sibling, 0 replies; 5+ messages in thread
From: David Miller @ 2018-07-08  1:32 UTC (permalink / raw)
  To: eric.dumazet; +Cc: lirongqing, netdev

From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Sat, 7 Jul 2018 17:22:01 -0700

> Maybe gro_count should be replaced by a bitmask, so that we can
> speed up napi_gro_flush(), since it now has to use 3 cache lines
> (gro_hash[] size is 192 bytes)

Something like this?

diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index b683971e500d..a4d859a7e9de 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -310,7 +310,7 @@ struct gro_list {
 /*
  * Structure for NAPI scheduling similar to tasklet but with weighting
  */
-#define GRO_HASH_BUCKETS	8
+#define GRO_HASH_BUCKETS	8	/* Must be <= 32 due to gro_mask */
 struct napi_struct {
 	/* The poll_list must only be managed by the entity which
 	 * changes the state of the NAPI_STATE_SCHED bit.  This means
@@ -322,7 +322,7 @@ struct napi_struct {
 
 	unsigned long		state;
 	int			weight;
-	unsigned int		gro_count;
+	unsigned int		gro_hash_mask;
 	int			(*poll)(struct napi_struct *, int);
 #ifdef CONFIG_NETPOLL
 	int			poll_owner;
diff --git a/net/core/dev.c b/net/core/dev.c
index 89825c1eccdc..0dfb84a82586 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -5158,12 +5158,14 @@ static void __napi_gro_flush_chain(struct napi_struct *napi, u32 index,
 
 	list_for_each_entry_safe_reverse(skb, p, head, list) {
 		if (flush_old && NAPI_GRO_CB(skb)->age == jiffies)
-			return;
+			goto out;
 		list_del_init(&skb->list);
 		napi_gro_complete(skb);
-		napi->gro_count--;
 		napi->gro_hash[index].count--;
 	}
+out:
+	if (list_empty(head))
+		napi->gro_hash_mask &= ~(1 << index);
 }
 
 /* napi->gro_hash[].list contains packets ordered by age.
@@ -5174,8 +5176,10 @@ void napi_gro_flush(struct napi_struct *napi, bool flush_old)
 {
 	u32 i;
 
-	for (i = 0; i < GRO_HASH_BUCKETS; i++)
-		__napi_gro_flush_chain(napi, i, flush_old);
+	for (i = 0; i < GRO_HASH_BUCKETS; i++) {
+		if (napi->gro_hash_mask & (1 << i))
+			__napi_gro_flush_chain(napi, i, flush_old);
+	}
 }
 EXPORT_SYMBOL(napi_gro_flush);
 
@@ -5267,8 +5271,8 @@ static void gro_flush_oldest(struct list_head *head)
 	if (WARN_ON_ONCE(!oldest))
 		return;
 
-	/* Do not adjust napi->gro_count, caller is adding a new SKB to
-	 * the chain.
+	/* Do not adjust napi->gro_hash_mask, caller is adding a new
+	 * SKB to the chain.
 	 */
 	list_del(&oldest->list);
 	napi_gro_complete(oldest);
@@ -5342,8 +5346,9 @@ static enum gro_result dev_gro_receive(struct napi_struct *napi, struct sk_buff
 	if (pp) {
 		list_del_init(&pp->list);
 		napi_gro_complete(pp);
-		napi->gro_count--;
 		napi->gro_hash[hash].count--;
+		if (list_empty(&napi->gro_hash[hash].list))
+			napi->gro_hash_mask &= ~(1 << hash);
 	}
 
 	if (same_flow)
@@ -5355,7 +5360,7 @@ static enum gro_result dev_gro_receive(struct napi_struct *napi, struct sk_buff
 	if (unlikely(napi->gro_hash[hash].count >= MAX_GRO_SKBS)) {
 		gro_flush_oldest(gro_head);
 	} else {
-		napi->gro_count++;
+		napi->gro_hash_mask |= (1 << hash);
 		napi->gro_hash[hash].count++;
 	}
 	NAPI_GRO_CB(skb)->count = 1;
@@ -5768,7 +5773,7 @@ bool napi_complete_done(struct napi_struct *n, int work_done)
 				 NAPIF_STATE_IN_BUSY_POLL)))
 		return false;
 
-	if (n->gro_count) {
+	if (n->gro_hash_mask) {
 		unsigned long timeout = 0;
 
 		if (work_done)
@@ -5977,7 +5982,7 @@ static enum hrtimer_restart napi_watchdog(struct hrtimer *timer)
 	/* Note : we use a relaxed variant of napi_schedule_prep() not setting
 	 * NAPI_STATE_MISSED, since we do not react to a device IRQ.
 	 */
-	if (napi->gro_count && !napi_disable_pending(napi) &&
+	if (napi->gro_hash_mask && !napi_disable_pending(napi) &&
 	    !test_and_set_bit(NAPI_STATE_SCHED, &napi->state))
 		__napi_schedule_irqoff(napi);
 
@@ -5992,7 +5997,7 @@ void netif_napi_add(struct net_device *dev, struct napi_struct *napi,
 	INIT_LIST_HEAD(&napi->poll_list);
 	hrtimer_init(&napi->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL_PINNED);
 	napi->timer.function = napi_watchdog;
-	napi->gro_count = 0;
+	napi->gro_hash_mask = 0;
 	for (i = 0; i < GRO_HASH_BUCKETS; i++) {
 		INIT_LIST_HEAD(&napi->gro_hash[i].list);
 		napi->gro_hash[i].count = 0;
@@ -6052,7 +6057,7 @@ void netif_napi_del(struct napi_struct *napi)
 	napi_free_frags(napi);
 
 	flush_gro_hash(napi);
-	napi->gro_count = 0;
+	napi->gro_hash_mask = 0;
 }
 EXPORT_SYMBOL(netif_napi_del);
 
@@ -6094,7 +6099,7 @@ static int napi_poll(struct napi_struct *n, struct list_head *repoll)
 		goto out_unlock;
 	}
 
-	if (n->gro_count) {
+	if (n->gro_hash_mask) {
 		/* flush too old packets
 		 * If HZ < 1000, flush all packets.
 		 */

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

* 答复: [PATCH][net-next][v2] net: limit each hash list length to MAX_GRO_SKBS
  2018-07-08  0:22   ` Eric Dumazet
  2018-07-08  1:32     ` David Miller
@ 2018-07-10 10:59     ` Li,Rongqing
  1 sibling, 0 replies; 5+ messages in thread
From: Li,Rongqing @ 2018-07-10 10:59 UTC (permalink / raw)
  To: Eric Dumazet, David Miller; +Cc: netdev



> -----邮件原件-----
> 发件人: Eric Dumazet [mailto:eric.dumazet@gmail.com]
> 发送时间: 2018年7月8日 8:22
> 收件人: David Miller <davem@davemloft.net>; Li,Rongqing
> <lirongqing@baidu.com>
> 抄送: netdev@vger.kernel.org
> 主题: Re: [PATCH][net-next][v2] net: limit each hash list length to
> MAX_GRO_SKBS
> 
> 
> 
> On 07/05/2018 03:20 AM, David Miller wrote:
> > From: Li RongQing <lirongqing@baidu.com>
> > Date: Thu,  5 Jul 2018 14:34:32 +0800
> >
> >> After commit 07d78363dcff ("net: Convert NAPI gro list into a small
> >> hash table.")' there is 8 hash buckets, which allows more flows to be
> >> held for merging.  but MAX_GRO_SKBS, the total held skb for merging,
> >> is 8 skb still, limit the hash table performance.
> >>
> >> keep MAX_GRO_SKBS as 8 skb, but limit each hash list length to 8 skb,
> >> not the total 8 skb
> >>
> >> Signed-off-by: Li RongQing <lirongqing@baidu.com>
> >
> > Applied, thanks.
> >
> 
> Maybe gro_count should be replaced by a bitmask, so that we can speed up
> napi_gro_flush(), since it now has to use 3 cache lines (gro_hash[] size is 192
> bytes)

Do you means that?

Subject: [PATCH][RFC][net-next] net: convert gro_count to bitmask

convert gro_count to a bitmask, and rename it as gro_bitmask to speed
up napi_gro_flush(), since gro_hash now has to use 3 cache lines

---
 include/linux/netdevice.h |  2 +-
 net/core/dev.c            | 36 ++++++++++++++++++++++++------------
 2 files changed, 25 insertions(+), 13 deletions(-)

diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index b683971e500d..df49b36ef378 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -322,7 +322,7 @@ struct napi_struct {
 
        unsigned long           state;
        int                     weight;
-       unsigned int            gro_count;
+       unsigned long           gro_bitmask;
        int                     (*poll)(struct napi_struct *, int);
 #ifdef CONFIG_NETPOLL
        int                     poll_owner;
diff --git a/net/core/dev.c b/net/core/dev.c
index 89825c1eccdc..da2d1185eb82 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -5161,9 +5161,11 @@ static void __napi_gro_flush_chain(struct napi_struct *napi, u32 index,
                        return;
                list_del_init(&skb->list);
                napi_gro_complete(skb);
-               napi->gro_count--;
                napi->gro_hash[index].count--;
        }
+
+       if (!napi->gro_hash[index].count)
+               clear_bit(index, &napi->gro_bitmask);
 }
 
 /* napi->gro_hash[].list contains packets ordered by age.
@@ -5174,8 +5176,10 @@ void napi_gro_flush(struct napi_struct *napi, bool flush_old)
 {
        u32 i;
 
-       for (i = 0; i < GRO_HASH_BUCKETS; i++)
-               __napi_gro_flush_chain(napi, i, flush_old);
+       for (i = 0; i < GRO_HASH_BUCKETS; i++) {
+               if (test_bit(i, &napi->gro_bitmask))
+                       __napi_gro_flush_chain(napi, i, flush_old);
+       }
 }
 EXPORT_SYMBOL(napi_gro_flush);
 
@@ -5267,8 +5271,8 @@ static void gro_flush_oldest(struct list_head *head)
        if (WARN_ON_ONCE(!oldest))
                return;
 
-       /* Do not adjust napi->gro_count, caller is adding a new SKB to
-        * the chain.
+       /* Do not adjust napi->gro_hash[].count, caller is adding a new
+        * SKB to the chain.
         */
        list_del(&oldest->list);
        napi_gro_complete(oldest);
@@ -5342,7 +5346,6 @@ static enum gro_result dev_gro_receive(struct napi_struct *napi, struct sk_buff
        if (pp) {
                list_del_init(&pp->list);
                napi_gro_complete(pp);
-               napi->gro_count--;
                napi->gro_hash[hash].count--;
        }
 
@@ -5355,7 +5358,6 @@ static enum gro_result dev_gro_receive(struct napi_struct *napi, struct sk_buff
        if (unlikely(napi->gro_hash[hash].count >= MAX_GRO_SKBS)) {
                gro_flush_oldest(gro_head);
        } else {
-               napi->gro_count++;
                napi->gro_hash[hash].count++;
        }
        NAPI_GRO_CB(skb)->count = 1;
@@ -5370,6 +5372,13 @@ static enum gro_result dev_gro_receive(struct napi_struct *napi, struct sk_buff
        if (grow > 0)
                gro_pull_from_frag0(skb, grow);
 ok:
+
+       if (napi->gro_hash[hash].count)
+               if (!test_bit(hash, &napi->gro_bitmask))
+                       set_bit(hash, &napi->gro_bitmask);
+       else if (test_bit(hash, &napi->gro_bitmask))
+               clear_bit(hash, &napi->gro_bitmask);
+
        return ret;
 
 normal:
@@ -5768,7 +5777,7 @@ bool napi_complete_done(struct napi_struct *n, int work_done)
                                 NAPIF_STATE_IN_BUSY_POLL)))
                return false;
 
-       if (n->gro_count) {
+       if (n->gro_bitmask) {
                unsigned long timeout = 0;
 
                if (work_done)
@@ -5977,7 +5986,7 @@ static enum hrtimer_restart napi_watchdog(struct hrtimer *timer)
        /* Note : we use a relaxed variant of napi_schedule_prep() not setting
         * NAPI_STATE_MISSED, since we do not react to a device IRQ.
         */
-       if (napi->gro_count && !napi_disable_pending(napi) &&
+       if (napi->gro_bitmask && !napi_disable_pending(napi) &&
            !test_and_set_bit(NAPI_STATE_SCHED, &napi->state))
                __napi_schedule_irqoff(napi);
 
@@ -5992,7 +6001,7 @@ void netif_napi_add(struct net_device *dev, struct napi_struct *napi,
        INIT_LIST_HEAD(&napi->poll_list);
        hrtimer_init(&napi->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL_PINNED);
        napi->timer.function = napi_watchdog;
-       napi->gro_count = 0;
+       napi->gro_bitmask = 0;
        for (i = 0; i < GRO_HASH_BUCKETS; i++) {
                INIT_LIST_HEAD(&napi->gro_hash[i].list);
                napi->gro_hash[i].count = 0;
@@ -6052,7 +6061,7 @@ void netif_napi_del(struct napi_struct *napi)
        napi_free_frags(napi);
 
        flush_gro_hash(napi);
-       napi->gro_count = 0;
+       napi->gro_bitmask = 0;
 }
 EXPORT_SYMBOL(netif_napi_del);
 
@@ -6094,7 +6103,7 @@ static int napi_poll(struct napi_struct *n, struct list_head *repoll)
                goto out_unlock;
        }
 
-       if (n->gro_count) {
+       if (n->gro_bitmask) {
                /* flush too old packets
                 * If HZ < 1000, flush all packets.
                 */
@@ -9141,6 +9150,9 @@ static struct hlist_head * __net_init netdev_create_hash(void)
 /* Initialize per network namespace state */
 static int __net_init netdev_init(struct net *net)
 {
+       BUILD_BUG_ON(GRO_HASH_BUCKETS >
+                       FIELD_SIZEOF(struct napi_struct, gro_bitmask));
+
        if (net != &init_net)
                INIT_LIST_HEAD(&net->dev_base_head);
 
-- 
2.16.2

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

end of thread, other threads:[~2018-07-10 10:59 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-05  6:34 [PATCH][net-next][v2] net: limit each hash list length to MAX_GRO_SKBS Li RongQing
2018-07-05 10:20 ` David Miller
2018-07-08  0:22   ` Eric Dumazet
2018-07-08  1:32     ` David Miller
2018-07-10 10:59     ` 答复: " Li,Rongqing

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