linux/net
Eric Dumazet e014debecd linkwatch: linkwatch_forget_dev() to speedup device dismantle
Herbert Xu a écrit :
> On Tue, Nov 17, 2009 at 04:26:04AM -0800, David Miller wrote:
>> Really, the link watch stuff is just due for a redesign.  I don't
>> think a simple hack is going to cut it this time, sorry Eric :-)
>
> I have no objections against any redesigns, but since the only
> caller of linkwatch_forget_dev runs in process context with the
> RTNL, it could also legally emit those events.

Thanks guys, here an updated version then, before linkwatch surgery ?

In this version, I force the event to be sent synchronously.

[PATCH net-next-2.6] linkwatch: linkwatch_forget_dev() to speedup device dismantle

time ip link del eth3.103 ; time ip link del eth3.104 ; time ip link del eth3.105

real	0m0.266s
user	0m0.000s
sys	0m0.001s

real	0m0.770s
user	0m0.000s
sys	0m0.000s

real	0m1.022s
user	0m0.000s
sys	0m0.000s

One problem of current schem in vlan dismantle phase is the
holding of device done by following chain :

vlan_dev_stop() ->
	netif_carrier_off(dev) ->
		linkwatch_fire_event(dev) ->
			dev_hold() ...

And __linkwatch_run_queue() runs up to one second later...

A generic fix to this problem is to add a linkwatch_forget_dev() method
to unlink the device from the list of watched devices.

dev->link_watch_next becomes dev->link_watch_list (and use a bit more memory),
to be able to unlink device in O(1).

After patch :
time ip link del eth3.103 ; time ip link del eth3.104 ; time ip link del eth3.105

real    0m0.024s
user    0m0.000s
sys     0m0.000s

real    0m0.032s
user    0m0.000s
sys     0m0.001s

real    0m0.033s
user    0m0.000s
sys     0m0.000s

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2009-11-18 05:03:11 -08:00
..
9p virtio: add virtio IDs file 2009-09-23 22:26:32 +09:30
802 net: remove COMPAT_NET_DEV_OPS 2009-05-25 01:53:53 -07:00
8021q vlan: Precise RX stats accounting 2009-11-17 23:51:55 -08:00
appletalk net/appletalk: using compat_ptr needs inclusion of linux/compat.h 2009-11-08 20:41:03 -08:00
atm net/atm: move all compat_ioctl handling to atm/ioctl.c 2009-11-11 19:22:23 -08:00
ax25 net: pass kern to net_proto_family create function 2009-11-05 22:18:14 -08:00
bluetooth Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6 2009-11-17 00:05:02 -08:00
bridge Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6 2009-11-06 00:55:55 -08:00
can CAN: use dev_get_by_index_rcu 2009-11-10 22:27:13 -08:00
core linkwatch: linkwatch_forget_dev() to speedup device dismantle 2009-11-18 05:03:11 -08:00
dcb net: fix double skb free in dcbnl 2009-09-26 20:16:15 -07:00
dccp net: drop capability from protocol definitions 2009-11-05 21:40:17 -08:00
decnet decnet: convert dndev_lock to spinlock 2009-11-11 19:22:18 -08:00
dsa netdev: convert pseudo-devices to netdev_tx_t 2009-09-01 01:13:07 -07:00
econet net: pass kern to net_proto_family create function 2009-11-05 22:18:14 -08:00
ethernet remove deprecated and not used: print_mac() 2009-11-15 22:21:34 -08:00
ieee802154 Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/lowpan/lowpan 2009-11-14 20:24:30 -08:00
ipv4 ipv4: factorize cache clearing for batched unregister operations 2009-11-18 05:03:07 -08:00
ipv6 ipv6: speedup inet6_dump_addr() 2009-11-13 20:46:57 -08:00
ipx net/ipx: push down BKL into a ipx_dgram_ops 2009-11-07 00:46:39 -08:00
irda net/irda: push BKL into proto_ops 2009-11-07 00:46:39 -08:00
iucv iucv: add work_queue cleanup for suspend 2009-11-13 20:46:58 -08:00
key net: pass kern to net_proto_family create function 2009-11-05 22:18:14 -08:00
lapb net: remove NET_RX_BAD and NET_RX_CN* defines 2009-07-05 19:15:35 -07:00
llc net: pass kern to net_proto_family create function 2009-11-05 22:18:14 -08:00
mac80211 Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-next-2.6 2009-11-09 11:17:24 -08:00
netfilter Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6 2009-11-08 23:00:54 -08:00
netlabel netlabel: remove dev_put() calls 2009-11-05 22:34:18 -08:00
netlink netlink: remove subscriptions check on notifier 2009-11-17 04:08:49 -08:00
netrom net: pass kern to net_proto_family create function 2009-11-05 22:18:14 -08:00
packet net: netlink_getname, packet_getname -- use DECLARE_SOCKADDR guard 2009-11-10 20:54:41 -08:00
phonet Phonet: missing rcu_dereference() 2009-11-17 04:08:50 -08:00
rds net: pass kern to net_proto_family create function 2009-11-05 22:18:14 -08:00
rfkill headers: remove sched.h from poll.h 2009-10-04 15:05:10 -07:00
rose Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6 2009-11-06 00:55:55 -08:00
rxrpc net: pass kern to net_proto_family create function 2009-11-05 22:18:14 -08:00
sched act_mirred: optimization. 2009-11-17 04:15:38 -08:00
sctp Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6 2009-11-17 00:05:02 -08:00
sunrpc Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6 2009-11-06 00:55:55 -08:00
tipc net: pass kern to net_proto_family create function 2009-11-05 22:18:14 -08:00
unix net: netlink_getname, packet_getname -- use DECLARE_SOCKADDR guard 2009-11-10 20:54:41 -08:00
wanrouter headers: smp_lock.h redux 2009-07-12 12:22:34 -07:00
wimax wimax: allow WIMAX_RF_QUERY calls when state is still uninitialized 2009-10-19 15:56:14 +09:00
wireless Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-next-2.6 2009-11-09 11:17:24 -08:00
x25 net/x25: push BKL usage into x25_proto 2009-11-07 00:46:40 -08:00
xfrm xfrm: SAD entries do not expire correctly after suspend-resume 2009-11-08 20:58:41 -08:00
Kconfig net/compat/wext: send different messages to compat tasks 2009-07-15 08:53:39 -07:00
Makefile net: remove redundant sched/ in net/Makefile 2009-07-12 20:11:14 -07:00
TUNABLE
compat.c net: Cleanup redundant tests on unsigned 2009-10-29 01:39:54 -07:00
nonet.c [PATCH] Make most file operations structs in fs/ const 2006-03-28 09:16:06 -08:00
socket.c net/atm: move all compat_ioctl handling to atm/ioctl.c 2009-11-11 19:22:23 -08:00
sysctl_net.c net: sysctl_net - use net_eq to compare nets 2009-03-16 16:23:30 +01:00