netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eric Dumazet <eric.dumazet@gmail.com>
To: "David S. Miller" <davem@davemloft.net>
Cc: Linux Netdev List <netdev@vger.kernel.org>
Subject: [net-next-2.6 PATCH 0/6] net: Speedup netdevice unregisters
Date: Tue, 27 Oct 2009 18:02:19 +0100	[thread overview]
Message-ID: <4AE7279B.7070300@gmail.com> (raw)

netdevice unregisters are serialized and call synchronize_{net|rcu}()
three times per device.

This means it can take a long time to remove a device, if many virtual
devices are attached. (vlan, macvlan, tunnels, ...)

This patch series partially solve the problem by batching several devices in a list,
so that two synchronize_net() calls can be factorized.

Some results on my dev machine (2x4 cpus, HZ=1000, PREEMPT):

modprobe dummy numdummies=10000
# unregister 10000 DOWN netdevices
time rmmod dummy

Before patches :

real    2m0.303s  (12 ms per device)
user    0m0.001s
sys     0m0.117s

After patches 1,2,3 :

real	0m1.111s
user	0m0.001s
sys	0m0.922s (mostly sysfs overhead)


modprobe dummy
ip link set dummy0 up
for f in `seq 1 1000`
do
 ip link add link dummy0 dummy0.$f type vlan id $f
 ip link set dummy0.$f up
done
# Dismantle of 1000 UP vlans (but no IP address)
time rmmod dummy

Before patches :

real    0m40.410s  (40 ms per vlan)
user    0m0.000s
sys     0m0.022s

After patches 1,2,3 :

real	0m20.990s
user	0m0.001s
sys	0m0.011s

After patch 4 (vlan: Use unregister_netdevice_many())

real	0m4.392s (-> 4.3 ms per vlan)
user	0m0.000s
sys	0m0.067s

We still have a synchronize_rcu() in dev_deactivate() that could be
factorized in followup patches if there is some interest.


PATCH 1/6 : net: Introduce unregister_netdevice_queue()
PATCH 2/6 : net: Introduce unregister_netdevice_many()
PATCH 3/6 : net: Add a list_head parameter to dellink() method
PATCH 4/6 : vlan: Optimize multiple unregistration
PATCH 5/6 : ipip: Optimize multiple unregistration
PATCH 6/6 : gre: Optimize multiple unregistration


             reply	other threads:[~2009-10-27 17:02 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-27 17:02 Eric Dumazet [this message]
2009-10-28  9:23 ` [net-next-2.6 PATCH 0/6] net: Speedup netdevice unregisters 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=4AE7279B.7070300@gmail.com \
    --to=eric.dumazet@gmail.com \
    --cc=davem@davemloft.net \
    --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).