[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230630071827.2078604-1-wenjian1@xiaomi.com>
Date: Fri, 30 Jun 2023 15:18:27 +0800
From: Jian Wen <wenjianhn@...il.com>
To: edumazet@...gle.com,
davem@...emloft.net
Cc: Jian Wen <wenjian1@...omi.com>,
netdev@...r.kernel.org,
wenjianhn@...il.com
Subject: [PATCH net-next] tcp: add a scheduling point in established_get_first()
Kubernetes[1] is going to stick with /proc/net/tcp for a while.
This commit reduces the scheduling latency introduced by established_get_first(),
similar to commit acffb584cda7 ("net: diag: add a scheduling point in inet_diag_dump_icsk()").
In our environment, the scheduling latency affects:
1. the performance of latency-sensitive services like Redis
2. the delay of synchronize_net() that is called with RTNL is locked
12 times when Dockerd is deleting a container
[1] https://github.com/google/cadvisor/blob/v0.47.2/container/libcontainer/handler.go#L130
Signed-off-by: Jian Wen <wenjian1@...omi.com>
---
net/ipv4/tcp_ipv4.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index fd365de4d5ff..3271848e9c9a 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -57,6 +57,7 @@
#include <linux/init.h>
#include <linux/times.h>
#include <linux/slab.h>
+#include <linux/sched.h>
#include <net/net_namespace.h>
#include <net/icmp.h>
@@ -2456,6 +2457,7 @@ static void *established_get_first(struct seq_file *seq)
return sk;
}
spin_unlock_bh(lock);
+ cond_resched();
}
return NULL;
--
2.25.1
Powered by blists - more mailing lists