mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-07-23 07:12:09 +00:00
net: Batch inet_twsk_purge
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: Eric W. Biederman <ebiederm@xmission.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
575f4cd5a5
commit
b099ce2602
4 changed files with 24 additions and 14 deletions
|
@ -2184,12 +2184,17 @@ static int tcpv6_net_init(struct net *net)
|
|||
static void tcpv6_net_exit(struct net *net)
|
||||
{
|
||||
inet_ctl_sock_destroy(net->ipv6.tcp_sk);
|
||||
inet_twsk_purge(net, &tcp_hashinfo, &tcp_death_row, AF_INET6);
|
||||
}
|
||||
|
||||
static void tcpv6_net_exit_batch(struct list_head *net_exit_list)
|
||||
{
|
||||
inet_twsk_purge(&tcp_hashinfo, &tcp_death_row, AF_INET6);
|
||||
}
|
||||
|
||||
static struct pernet_operations tcpv6_net_ops = {
|
||||
.init = tcpv6_net_init,
|
||||
.exit = tcpv6_net_exit,
|
||||
.init = tcpv6_net_init,
|
||||
.exit = tcpv6_net_exit,
|
||||
.exit_batch = tcpv6_net_exit_batch,
|
||||
};
|
||||
|
||||
int __init tcpv6_init(void)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue