aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorFlavio Leitner <fbl@redhat.com>2012-01-25 03:34:52 -0500
committerDavid S. Miller <davem@davemloft.net>2012-01-25 21:50:43 -0500
commitfddb7b5761f104f034a0e708ece756d9b2eb2cac (patch)
treef995ec889ebc1edc3fc9d3b0fe1da1fe9c2d6b76 /net
parent2b05ad33e1e624e7f08b8676d270dc7725403b7e (diff)
tcp: bind() optimize port allocation
Port autoselection finds a port and then drop the lock, then right after that, gets the hash bucket again and lock it. Fix it to go direct. Signed-off-by: Flavio Leitner <fbl@redhat.com> Signed-off-by: Marcelo Ricardo Leitner <mleitner@redhat.com> Acked-by: Eric Dumazet <eric.dumazet@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/ipv4/inet_connection_sock.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/net/ipv4/inet_connection_sock.c b/net/ipv4/inet_connection_sock.c
index ecd19b5a7ee2..19d66cefd7d3 100644
--- a/net/ipv4/inet_connection_sock.c
+++ b/net/ipv4/inet_connection_sock.c
@@ -123,15 +123,13 @@ again:
123 smallest_size = tb->num_owners; 123 smallest_size = tb->num_owners;
124 smallest_rover = rover; 124 smallest_rover = rover;
125 if (atomic_read(&hashinfo->bsockets) > (high - low) + 1) { 125 if (atomic_read(&hashinfo->bsockets) > (high - low) + 1) {
126 spin_unlock(&head->lock);
127 snum = smallest_rover; 126 snum = smallest_rover;
128 goto have_snum; 127 goto tb_found;
129 } 128 }
130 } 129 }
131 if (!inet_csk(sk)->icsk_af_ops->bind_conflict(sk, tb)) { 130 if (!inet_csk(sk)->icsk_af_ops->bind_conflict(sk, tb)) {
132 spin_unlock(&head->lock);
133 snum = rover; 131 snum = rover;
134 goto have_snum; 132 goto tb_found;
135 } 133 }
136 goto next; 134 goto next;
137 } 135 }