From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
To: Eric Dumazet <eric.dumazet@gmail.com>
Cc: David Miller <davem@davemloft.net>, netdev <netdev@vger.kernel.org>
Subject: Re: [PATCH] net: use synchronize_rcu_expedited()
Date: Tue, 24 May 2011 08:44:45 -0700 [thread overview]
Message-ID: <20110524154445.GC2266@linux.vnet.ibm.com> (raw)
In-Reply-To: <1306228052.3026.16.camel@edumazet-laptop>
On Tue, May 24, 2011 at 11:07:32AM +0200, Eric Dumazet wrote:
> synchronize_rcu() is very slow in various situations (HZ=100,
> CONFIG_NO_HZ=y, CONFIG_PREEMPT=n)
>
> Extract from my (mostly idle) 8 core machine :
>
> synchronize_rcu() in 99985 us
> synchronize_rcu() in 79982 us
> synchronize_rcu() in 87612 us
> synchronize_rcu() in 79827 us
> synchronize_rcu() in 109860 us
> synchronize_rcu() in 98039 us
> synchronize_rcu() in 89841 us
> synchronize_rcu() in 79842 us
> synchronize_rcu() in 80151 us
> synchronize_rcu() in 119833 us
> synchronize_rcu() in 99858 us
> synchronize_rcu() in 73999 us
> synchronize_rcu() in 79855 us
> synchronize_rcu() in 79853 us
>
>
> When we hold RTNL mutex, we would like to spend some cpu cycles but not
> block too long other processes waiting for this mutex.
>
> We also want to setup/dismantle network features as fast as possible at
> boot/shutdown time.
>
> This patch makes synchronize_net() call the expedited version if RTNL is
> locked.
>
> synchronize_rcu_expedited() typical delay is about 20 us on my machine.
>
> synchronize_rcu_expedited() in 18 us
> synchronize_rcu_expedited() in 18 us
> synchronize_rcu_expedited() in 18 us
> synchronize_rcu_expedited() in 18 us
> synchronize_rcu_expedited() in 20 us
> synchronize_rcu_expedited() in 16 us
> synchronize_rcu_expedited() in 20 us
> synchronize_rcu_expedited() in 18 us
> synchronize_rcu_expedited() in 18 us
Cool!!!
Just out of curiosity, how many CPUs does your system have?
Reviewed-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
> Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
> CC: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
> CC: Ben Greear <greearb@candelatech.com>
> ---
> net/core/dev.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/net/core/dev.c b/net/core/dev.c
> index bcb05cb..ec11d75 100644
> --- a/net/core/dev.c
> +++ b/net/core/dev.c
> @@ -5954,7 +5954,10 @@ EXPORT_SYMBOL(free_netdev);
> void synchronize_net(void)
> {
> might_sleep();
> - synchronize_rcu();
> + if (rtnl_is_locked())
> + synchronize_rcu_expedited();
> + else
> + synchronize_rcu();
> }
> EXPORT_SYMBOL(synchronize_net);
>
>
>
next prev parent reply other threads:[~2011-05-24 15:44 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-24 9:07 [PATCH] net: use synchronize_rcu_expedited() Eric Dumazet
2011-05-24 15:44 ` Paul E. McKenney [this message]
2011-05-24 15:52 ` Eric Dumazet
2011-05-24 19:24 ` Paul E. McKenney
2011-05-24 19:44 ` Eric Dumazet
2011-05-24 19:56 ` Paul E. McKenney
2011-05-24 17:28 ` 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=20110524154445.GC2266@linux.vnet.ibm.com \
--to=paulmck@linux.vnet.ibm.com \
--cc=davem@davemloft.net \
--cc=eric.dumazet@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.