net: Batch inet_twsk_purge
Eric W. Biederman authored

This function walks the whole hashtable so there is no point in
passing it a network namespace.  Instead I purge all timewait
sockets from dead network namespaces that I find.  If the namespace
is one of the once I am trying to purge I am guaranteed no new timewait
sockets can be formed so this will get them all.  If the namespace
is one I am not acting for it might form a few more but I will
call inet_twsk_purge again and  shortly to get rid of them.  In
any even if the network namespace is dead timewait sockets are
useless.

Move the calls of inet_twsk_purge into batch_exit routines so
that if I am killing a bunch of namespaces at once I will just
call inet_twsk_purge once and save a lot of redundant unnecessary
work.

My simple 4k network namespace exit test the cleanup time dropped from
roughly 8.2s to 1.6s.  While the time spent running inet_twsk_purge fell
to about 2ms.  1ms for ipv4 and 1ms for ipv6.
Signed-off-by: default avatarEric W. Biederman <ebiederm@xmission.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
b099ce26
Name Last commit Last update
..
802 net: remove COMPAT_NET_DEV_OPS
8021q net: Teach vlans to cleanup as a pernet subsystem
9p net: Move && and || to end of previous line
appletalk net: use net_eq to compare nets
atm net: use net_eq to compare nets
ax25 net: use net_eq to compare nets
bluetooth net: Move && and || to end of previous line
bridge net: Move && and || to end of previous line
can net: Move && and || to end of previous line
core net: Allow fib_rule_unregister to batch
dcb net: Move && and || to end of previous line
dccp TCPCT part 1a: add request_values parameter for sending SYNACK
decnet net: Allow fib_rule_unregister to batch
dsa netdev: convert pseudo-devices to netdev_tx_t
econet net: use net_eq to compare nets
ethernet remove deprecated and not used: print_mac()
ieee802154 net: use net_eq to compare nets
ipv4 net: Batch inet_twsk_purge
ipv6 net: Batch inet_twsk_purge
ipx net: use net_eq to compare nets
irda net: Move && and || to end of previous line
iucv iucv: add work_queue cleanup for suspend
key net: Simplify af_key pernet operations.
lapb net: remove NET_RX_BAD and NET_RX_CN* defines
llc net: use net_eq to compare nets
mac80211
netfilter
netlabel
netlink
netrom
packet
phonet
rds
rfkill
rose
rxrpc
sched
sctp
sunrpc
tipc
unix
wanrouter
wimax
wireless
x25
xfrm
Kconfig
Makefile
TUNABLE
compat.c
nonet.c
socket.c
sysctl_net.c