From: Eric Dumazet <eric.dumazet@gmail.com>
To: Li RongQing <lirongqing@baidu.com>, netdev@vger.kernel.org
Subject: Re: [PATCH] net: convert gro_count to bitmask
Date: Wed, 11 Jul 2018 04:32:20 -0700 [thread overview]
Message-ID: <56c49677-8b55-b337-7f5a-c297a11c82b0@gmail.com> (raw)
In-Reply-To: <1531300553-21413-1-git-send-email-lirongqing@baidu.com>
On 07/11/2018 02:15 AM, Li RongQing wrote:
> gro_hash size is 192 bytes, and uses 3 cache lines, if there is few
> flows, gro_hash may be not fully used, so it is unnecessary to iterate
> all gro_hash in napi_gro_flush(), to occupy unnecessary cacheline.
>
> convert gro_count to a bitmask, and rename it as gro_bitmask, each bit
> represents a element of gro_hash, only flush a gro_hash element if the
> related bit is set, to speed up napi_gro_flush().
>
> and update gro_bitmask only if it will be changed, to reduce cache
> update
>
> Suggested-by: Eric Dumazet <edumazet@google.com>
> Signed-off-by: Li RongQing <lirongqing@baidu.com>
> ---
> include/linux/netdevice.h | 2 +-
> net/core/dev.c | 35 +++++++++++++++++++++++------------
> 2 files changed, 24 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 d13cddcac41f..a08dbdd217a6 100644
> --- a/net/core/dev.c
> +++ b/net/core/dev.c
> @@ -5171,9 +5171,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);
I suggest you not add an atomic operation here.
Current cpu owns this NAPI after all.
Same remark for the whole patch.
-> __clear_bit(), __set_bit() and similar operators
Ideally you should provide TCP_RR number with busy polling enabled, to eventually catch regressions.
Thanks.
next prev parent reply other threads:[~2018-07-11 11:36 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-11 9:15 [PATCH] net: convert gro_count to bitmask Li RongQing
2018-07-11 10:51 ` Stefano Brivio
2018-07-12 2:31 ` 答复: " Li,Rongqing
2018-07-12 9:48 ` Stefano Brivio
2018-07-11 11:32 ` Eric Dumazet [this message]
2018-07-12 2:31 ` 答复: " Li,Rongqing
2018-07-12 2:49 ` David Miller
2018-07-12 3:03 ` 答复: " Li,Rongqing
2018-07-12 3:51 ` David Miller
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=56c49677-8b55-b337-7f5a-c297a11c82b0@gmail.com \
--to=eric.dumazet@gmail.com \
--cc=lirongqing@baidu.com \
--cc=netdev@vger.kernel.org \
/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).