Commit 51d555cf authored by David S. Miller's avatar David S. Miller
Browse files

Merge branch 'netns-speedup-dismantle'



Eric Dumazet says:

====================
netns: speedup netns dismantles

netns are dismantled by a single thread, from cleanup_net()

On hosts with many TCP sockets, and/or many cpus, this thread
is spending too many cpu cycles, and can not keep up with some
workloads.

- Removing 3*num_possible_cpus() sockets per netns, for icmp and tcp protocols.
- Iterating over all TCP sockets to remove stale timewait sockets.

This patch series removes ~50% of cleanup_net() cpu costs on
hosts with 256 cpus. It also reduces per netns memory footprint.
====================

Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 8a0de61c 37ba017d
Loading
Loading
Loading
Loading
+3 −5
Original line number Diff line number Diff line
@@ -65,13 +65,13 @@ struct inet_timewait_sock {
	/* these three are in inet_sock */
	__be16			tw_sport;
	/* And these are ours. */
	unsigned int		tw_kill		: 1,
				tw_transparent  : 1,
	unsigned int		tw_transparent  : 1,
				tw_flowlabel	: 20,
				tw_pad		: 2,	/* 2 bits hole */
				tw_pad		: 3,	/* 3 bits hole */
				tw_tos		: 8;
	u32			tw_txhash;
	u32			tw_priority;
	u32			tw_bslot; /* bind bucket slot */
	struct timer_list	tw_timer;
	struct inet_bind_bucket	*tw_tb;
};
@@ -110,8 +110,6 @@ static inline void inet_twsk_reschedule(struct inet_timewait_sock *tw, int timeo

void inet_twsk_deschedule_put(struct inet_timewait_sock *tw);

void inet_twsk_purge(struct inet_hashinfo *hashinfo, int family);

static inline
struct net *twsk_net(const struct inet_timewait_sock *twsk)
{
+0 −2
Original line number Diff line number Diff line
@@ -70,11 +70,9 @@ struct netns_ipv4 {
	struct hlist_head	*fib_table_hash;
	struct sock		*fibnl;

	struct sock  * __percpu	*icmp_sk;
	struct sock		*mc_autojoin_sk;

	struct inet_peer_base	*peers;
	struct sock  * __percpu	*tcp_sk;
	struct fqdir		*fqdir;

	u8 sysctl_icmp_echo_ignore_all;
+0 −1
Original line number Diff line number Diff line
@@ -88,7 +88,6 @@ struct netns_ipv6 {
	struct fib6_table       *fib6_local_tbl;
	struct fib_rules_ops    *fib6_rules_ops;
#endif
	struct sock * __percpu	*icmp_sk;
	struct sock             *ndisc_sk;
	struct sock             *tcp_sk;
	struct sock             *igmp_sk;
+0 −6
Original line number Diff line number Diff line
@@ -1030,15 +1030,9 @@ static void __net_exit dccp_v4_exit_net(struct net *net)
	inet_ctl_sock_destroy(pn->v4_ctl_sk);
}

static void __net_exit dccp_v4_exit_batch(struct list_head *net_exit_list)
{
	inet_twsk_purge(&dccp_hashinfo, AF_INET);
}

static struct pernet_operations dccp_v4_ops = {
	.init	= dccp_v4_init_net,
	.exit	= dccp_v4_exit_net,
	.exit_batch = dccp_v4_exit_batch,
	.id	= &dccp_v4_pernet_id,
	.size   = sizeof(struct dccp_v4_pernet),
};
+0 −6
Original line number Diff line number Diff line
@@ -1115,15 +1115,9 @@ static void __net_exit dccp_v6_exit_net(struct net *net)
	inet_ctl_sock_destroy(pn->v6_ctl_sk);
}

static void __net_exit dccp_v6_exit_batch(struct list_head *net_exit_list)
{
	inet_twsk_purge(&dccp_hashinfo, AF_INET6);
}

static struct pernet_operations dccp_v6_ops = {
	.init   = dccp_v6_init_net,
	.exit   = dccp_v6_exit_net,
	.exit_batch = dccp_v6_exit_batch,
	.id	= &dccp_v6_pernet_id,
	.size   = sizeof(struct dccp_v6_pernet),
};
Loading