net: Add a second bind table hashed by port and address
Subsystems (2)
Kuniyuki Iwashima
Acked-byFrom: Joanne Koong <[email protected]>
Date: Wed, 18 May 2022 16:19:11 -0700
Quoted 10 lines
We currently have one tcp bind table (bhash) which hashes by port number only. In the socket bind path, we check for bind conflicts by traversing the specified port's
inet_bind2_bucketwhile holding the bucket's spinlock (seeinet_csk_get_port()andinet_csk_bind_conflict()).In instances where there are tons of sockets hashed to the same port at different addresses, checking for a bind conflict is time-intensive and can cause softirq cpu lockups, as well as stops new tcp connections since
__inet_inherit_port()also contests for the spinlock.
Quoted 6 lines
This patch proposes adding a second bind table, bhash2, that hashes by port and ip address. Searching the bhash2 table leads to significantly faster conflict resolution and less time holding the spinlock.
Signed-off-by Joanne Koong <[email protected]>Reviewed-by Eric Dumazet <[email protected]>
To maintainers:
lore and patchwork seem to miss this version...?
Thank you.
Jakub Kicinski
maintainerQuoted 2 lines · On Thu, 19 May 2022 16:51:19 +0900 Kuniyuki Iwashima wrote:
To maintainers:
lore and patchwork seem to miss this version...?
Yeah :( We're trying to debug with Joanne and the vger admin, if we can't fix it by the end of the day I'll just merge the last posting that made it thru, IIRC the patches are identical.
Thanks for the review!