mbox series

[net-next,0/6] netns: speedup netns dismantles

Message ID 20220124202457.3450198-1-eric.dumazet@gmail.com (mailing list archive)
Headers show
Series netns: speedup netns dismantles | expand

Message

Eric Dumazet Jan. 24, 2022, 8:24 p.m. UTC
From: Eric Dumazet <edumazet@google.com>

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.

Eric Dumazet (6):
  tcp/dccp: add tw->tw_bslot
  tcp/dccp: no longer use twsk_net(tw) from tw_timer_handler()
  tcp/dccp: get rid of inet_twsk_purge()
  ipv4: do not use per netns icmp sockets
  ipv6: do not use per netns icmp sockets
  ipv4/tcp: do not use per netns ctl sockets

 include/net/inet_timewait_sock.h |  8 ++-
 include/net/netns/ipv4.h         |  2 -
 include/net/netns/ipv6.h         |  1 -
 net/dccp/ipv4.c                  |  6 ---
 net/dccp/ipv6.c                  |  6 ---
 net/ipv4/icmp.c                  | 91 +++++++++++---------------------
 net/ipv4/inet_timewait_sock.c    | 67 ++++-------------------
 net/ipv4/tcp_ipv4.c              | 63 ++++++++++------------
 net/ipv6/icmp.c                  | 62 ++++------------------
 net/ipv6/tcp_ipv6.c              |  6 ---
 10 files changed, 82 insertions(+), 230 deletions(-)

Comments

Jakub Kicinski Jan. 25, 2022, 6:02 p.m. UTC | #1
On Mon, 24 Jan 2022 12:24:51 -0800 Eric Dumazet wrote:
> From: Eric Dumazet <edumazet@google.com>
> 
> 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.

Applied, thanks, 51d555cfdcc6 ("Merge branch
'netns-speedup-dismantle'") in net-next.