diff options
author | David S. Miller <davem@davemloft.net> | 2017-01-18 13:04:30 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-01-18 13:04:30 -0500 |
commit | b16ed2b1d0eee0425037a159e5d99fa4b6535921 (patch) | |
tree | 32d780078fd8ec3257216e568cf06a0bac5ca581 /net/lapb | |
parent | ab70e5862670177d207ea0e0e16454e4083a5ad5 (diff) | |
parent | 637bc8bbe6c0a288a596edfdcdd5657c72a848db (diff) | |
download | linux-b16ed2b1d0eee0425037a159e5d99fa4b6535921.tar.bz2 |
Merge branch 'rework-inet_csk_get_port'
Josef Bacik says:
====================
Rework inet_csk_get_port
V3->V4:
-Removed the random include of addrconf.h that is no longer needed.
V2->V3:
-Dropped the fastsock from the tb and instead just carry the saddrs, family, and
ipv6 only flag.
-Reworked the helper functions to deal with this change so I could still use
them when checking the fast path.
-Killed tb->num_owners as per Eric's request.
-Attached a reproducer to the bottom of this email.
V1->V2:
-Added a new patch 'inet: collapse ipv4/v6 rcv_saddr_equal functions into one'
at Hannes' suggestion.
-Dropped ->bind_conflict and just use the new helper.
-Fixed a compile bug from the original ->bind_conflict patch.
The original description of the series follows:
At some point recently the guys working on our load balancer added the ability
to use SO_REUSEPORT. When they restarted their app with this option enabled
they immediately hit a softlockup on what appeared to be the
inet_bind_bucket->lock. Eventually what all of our debugging and discussion led
us to was the fact that the application comes up without SO_REUSEPORT, shuts
down which creates around 100k twsk's, and then comes up and tries to open a
bunch of sockets using SO_REUSEPORT, which meant traversing the inet_bind_bucket
owners list under the lock. Since this lock is needed for dealing with the
twsk's and basically anything else related to connections we would softlockup,
and sometimes not ever recover.
To solve this problem I did what you see in Path 5/5. Once we have a
SO_REUSEPORT socket on the tb->owners list we know that the socket has no
conflicts with any of the other sockets on that list. So we can add a copy of
the sock_common (really all we need is the recv_saddr but it seemed ugly to copy
just the ipv6, ipv4, and flag to indicate if we were ipv6 only in there so I've
copied the whole common) in order to check subsequent SO_REUSEPORT sockets. If
they match the previous one then we can skip the expensive
inet_csk_bind_conflict check. This is what eliminated the soft lockup that we
were seeing.
Patches 1-4 are cleanups and re-workings. For instance when we specify port ==
0 we need to find an open port, but we would do two passes through
inet_csk_bind_conflict every time we found a possible port. We would also keep
track of the smallest_port value in order to try and use it if we found no
port our first run through. This however made no sense as it would have had to
fail the first pass through inet_csk_bind_conflict, so would not actually pass
the second pass through either. Finally I split the function into two functions
in order to make it easier to read and to distinguish between the two behaviors.
I have tested this on one of our load balancing boxes during peak traffic and it
hasn't fallen over. But this is not my area, so obviously feel free to point
out where I'm being stupid and I'll get it fixed up and retested. Thanks,
====================
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/lapb')
0 files changed, 0 insertions, 0 deletions