netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Cong Wang <amwang@redhat.com>
To: Stephen Hemminger <shemminger@vyatta.com>
Cc: David Miller <davem@davemloft.net>,
	Eric Dumazet <dada1@cosmosbay.com>,
	netdev@vger.kernel.org
Subject: Re: [RFC net-next] netpoll: use static branch
Date: Wed, 19 Sep 2012 12:50:10 +0800	[thread overview]
Message-ID: <1348030210.11754.7.camel@cr0> (raw)
In-Reply-To: <20120918141014.573734db@nehalam.linuxnetplumber.net>

On Tue, 2012-09-18 at 14:10 -0700, Stephen Hemminger wrote:
> This is an attempt to optimize netpoll when not used.
> 
> Since distro's enable everything and netpoll is only occasionally
> used, improve performance by getting netpoll condition check
> out of the Rx fastpath.
> 
> Compile tested only, I have no real use for netpoll.
> 
> Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
> 
> 
> ---
>  include/linux/netpoll.h |   28 ++++++++++++++++++++--------
>  net/core/netpoll.c      |    8 +++++++-
>  2 files changed, 27 insertions(+), 9 deletions(-)
> 
> --- a/include/linux/netpoll.h	2012-09-18 13:25:15.575750004 -0700
> +++ b/include/linux/netpoll.h	2012-09-18 13:29:16.245323347 -0700
> @@ -66,10 +66,16 @@ static inline void netpoll_send_skb(stru
>  
> 
>  #ifdef CONFIG_NETPOLL
> +extern struct static_key netpoll_needed;
> +
>  static inline bool netpoll_rx_on(struct sk_buff *skb)
>  {
> -	struct netpoll_info *npinfo = rcu_dereference_bh(skb->dev->npinfo);
> +	struct netpoll_info *npinfo;
> +
> +	if (static_key_true(&netpoll_needed))
> +		return false;
>  

I think we should use static_key_false() here, as netpoll is an
"unlikely" code path.

Using static branch is a good idea though.

Thanks.

  reply	other threads:[~2012-09-19  4:50 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-18 21:10 [RFC net-next] netpoll: use static branch Stephen Hemminger
2012-09-19  4:50 ` Cong Wang [this message]
2012-09-19 20:00   ` Stephen Hemminger
2012-09-20  7:30     ` Cong Wang

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=1348030210.11754.7.camel@cr0 \
    --to=amwang@redhat.com \
    --cc=dada1@cosmosbay.com \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    --cc=shemminger@vyatta.com \
    /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).