]> git.baikalelectronics.ru Git - kernel.git/commit
net: selftests: Stress reuseport listen
authorMartin KaFai Lau <kafai@fb.com>
Thu, 12 May 2022 00:06:11 +0000 (17:06 -0700)
committerJakub Kicinski <kuba@kernel.org>
Thu, 12 May 2022 23:52:18 +0000 (16:52 -0700)
commitd44c2afa7ed9ff236dec9b7b2ec9b6f5d03a6034
tree7d2bdd36a14880cafe9595bf3317696342ea33b9
parent1a7413d0cf7cf2604487699dd443d059dd4bcc3a
net: selftests: Stress reuseport listen

This patch adds a test that has 300 VIPs listening on port 443.
Each VIP:443 will have 80 listening socks by using SO_REUSEPORT.
Thus, it will have 24000 listening socks.

Before removing the port only listening_hash, all socks will be in the
same port 443 bucket and inet_reuseport_add_sock() spends much time to
walk through the bucket.  After removing the port only listening_hash
and move all usage to the port+addr lhash2, each bucket in the
ideal case has 80 sk which is much smaller than before.

Here is the test result from a qemu:
Before: listen 24000 socks took 210.210485362 (~210s)
 After: listen 24000 socks took 0.207173      (~210ms)

Signed-off-by: Martin KaFai Lau <kafai@fb.com>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
tools/testing/selftests/net/Makefile
tools/testing/selftests/net/stress_reuseport_listen.c [new file with mode: 0644]
tools/testing/selftests/net/stress_reuseport_listen.sh [new file with mode: 0755]