From: Joanne Koong <joannelkoong@gmail.com>
To: netdev@vger.kernel.org
Cc: edumazet@google.com, kafai@fb.com, kuba@kernel.org,
davem@davemloft.net, Joanne Koong <joannelkoong@gmail.com>
Subject: [PATCH net-next v3 0/2] Add a bhash2 table hashed by port + address
Date: Tue, 10 May 2022 17:04:22 -0700 [thread overview]
Message-ID: <20220511000424.2223932-1-joannelkoong@gmail.com> (raw)
This patchset proposes adding a bhash2 table that hashes by port and address.
The motivation behind bhash2 is to expedite bind requests in situations where
the port has many sockets in its bhash table entry, which makes checking bind
conflicts costly especially given that we acquire the table entry spinlock
while doing so, which can cause softirq cpu lockups and can prevent new tcp
connections.
We ran into this problem at Meta where the traffic team binds a large number
of IPs to port 443 and the bind() call took a significant amount of time
which led to cpu softirq lockups, which caused packet drops and other failures
on the machine
The patches are as follows:
1/2 - Adds a second bhash table (bhash2) hashed by port and address
2/2 - Adds a test for timing how long an additional bind request takes when
the bhash entry is populated
When experimentally testing this on a local server for ~24k sockets bound to
the port, the results seen were:
ipv4:
before - 0.002317 seconds
with bhash2 - 0.000018 seconds
ipv6:
before - 0.002431 seconds
with bhash2 - 0.000021 seconds
v2 -> v3:
v2:
https://lore.kernel.org/netdev/20220510005316.3967597-1-joannelkoong@gmail.com/
* Fix bhash2 allocation error handling for dccp
* Rebase onto net-next/master
v1 -> v2:
v1:
https://lore.kernel.org/netdev/20220421221449.1817041-1-joannelkoong@gmail.com/
* Attached test for timing bind request
Joanne Koong (2):
net: Add a second bind table hashed by port and address
selftests: Add test for timing a bind request to a port with a
populated bhash entry
include/net/inet_connection_sock.h | 3 +
include/net/inet_hashtables.h | 56 ++++-
include/net/sock.h | 14 ++
net/dccp/proto.c | 34 ++-
net/ipv4/inet_connection_sock.c | 227 +++++++++++++-----
net/ipv4/inet_hashtables.c | 188 ++++++++++++++-
net/ipv4/tcp.c | 14 +-
tools/testing/selftests/net/.gitignore | 1 +
tools/testing/selftests/net/Makefile | 2 +
tools/testing/selftests/net/bind_bhash_test.c | 119 +++++++++
10 files changed, 576 insertions(+), 82 deletions(-)
create mode 100644 tools/testing/selftests/net/bind_bhash_test.c
--
2.30.2
next reply other threads:[~2022-05-11 0:05 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-11 0:04 Joanne Koong [this message]
2022-05-11 0:04 ` [PATCH net-next v3 1/2] net: Add a second bind table hashed by port and address Joanne Koong
2022-05-11 2:05 ` Eric Dumazet
2022-05-12 1:09 ` Joanne Koong
2022-05-12 1:39 ` Eric Dumazet
2022-05-11 0:04 ` [PATCH net-next v3 2/2] selftests: Add test for timing a bind request to a port with a populated bhash entry Joanne Koong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220511000424.2223932-1-joannelkoong@gmail.com \
--to=joannelkoong@gmail.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kafai@fb.com \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).