Netdev List
 help / color / mirror / Atom feed
From: Eric Dumazet <eric.dumazet@gmail.com>
To: gfree.wind@vip.163.com
Cc: davem@davemloft.net, netdev@vger.kernel.org
Subject: Re: [PATCH net-next] net: rps: Add the rfs_needed check when record flow hash
Date: Thu, 25 May 2017 07:55:03 -0700	[thread overview]
Message-ID: <1495724103.6465.98.camel@edumazet-glaptop3.roam.corp.google.com> (raw)
In-Reply-To: <1495611359-118199-1-git-send-email-gfree.wind@vip.163.com>

On Wed, 2017-05-24 at 15:35 +0800, gfree.wind@vip.163.com wrote:
> From: Gao Feng <gfree.wind@vip.163.com>
> 
> There are two spots which invoke the sock_rps_record_flow_hash, one is
> sock_rps_record_flow which has already checked rfs_needed. But the other
> is tun_flow_update which doesn't check if the rfs is enabled.
> 
> Now rename the original function sock_rps_record_flow_hash to
> _sock_rps_record_flow_hash, and add one helper func which checks the
> rfs_needed.
> 
> The perf result of two functions is following.
> When rfs is disabled, it could enhance 58% performance with checking
> rfs_needed.
> When rfs is enabled, the performanc is lower than current about 29%.
> 
> Because the RFS is disabled by default. I think it is useful to tun
> driver.
> 
> The follow is test statistics.

> Signed-off-by: Gao Feng <gfree.wind@vip.163.com>
> ---
>  include/net/sock.h | 12 ++++++++++--
>  1 file changed, 10 insertions(+), 2 deletions(-)
> 
> diff --git a/include/net/sock.h b/include/net/sock.h
> index 3467d9e..584bb9a 100644
> --- a/include/net/sock.h
> +++ b/include/net/sock.h
> @@ -910,7 +910,7 @@ static inline void sk_incoming_cpu_update(struct sock *sk)
>  	sk->sk_incoming_cpu = raw_smp_processor_id();
>  }
>  
> -static inline void sock_rps_record_flow_hash(__u32 hash)
> +static inline void _sock_rps_record_flow_hash(__u32 hash)
>  {
>  #ifdef CONFIG_RPS
>  	struct rps_sock_flow_table *sock_flow_table;
> @@ -922,6 +922,14 @@ static inline void sock_rps_record_flow_hash(__u32 hash)
>  #endif
>  }
>  
> +static inline void sock_rps_record_flow_hash(__u32 hash)
> +{
> +#ifdef CONFIG_RPS
> +	if (static_key_false(&rfs_needed))
> +		_sock_rps_record_flow_hash(hash);
> +#endif

Seems that after your patch, sock_rps_record_flow_hash() is no longer
needed/used.

  reply	other threads:[~2017-05-25 14:55 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-24  7:35 [PATCH net-next] net: rps: Add the rfs_needed check when record flow hash gfree.wind
2017-05-25 14:55 ` Eric Dumazet [this message]
2017-05-25 17:11 ` David Miller
2017-05-26  0:32   ` Gao Feng

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=1495724103.6465.98.camel@edumazet-glaptop3.roam.corp.google.com \
    --to=eric.dumazet@gmail.com \
    --cc=davem@davemloft.net \
    --cc=gfree.wind@vip.163.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