From: Flavio Leitner <fbl@redhat.com>
To: netdev <netdev@vger.kernel.org>
Cc: Marcelo Leitner <mleitner@redhat.com>,
Eric Dumazet <eric.dumazet@gmail.com>,
Flavio Leitner <fbl@redhat.com>
Subject: [PATCH 2/2] tcp: bind() optimize port allocation
Date: Wed, 25 Jan 2012 16:34:52 -0200 [thread overview]
Message-ID: <1327516492-9045-2-git-send-email-fbl@redhat.com> (raw)
In-Reply-To: <1327516492-9045-1-git-send-email-fbl@redhat.com>
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>
---
net/ipv4/inet_connection_sock.c | 6 ++----
1 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/net/ipv4/inet_connection_sock.c b/net/ipv4/inet_connection_sock.c
index ecd19b5..19d66ce 100644
--- a/net/ipv4/inet_connection_sock.c
+++ b/net/ipv4/inet_connection_sock.c
@@ -123,15 +123,13 @@ again:
smallest_size = tb->num_owners;
smallest_rover = rover;
if (atomic_read(&hashinfo->bsockets) > (high - low) + 1) {
- spin_unlock(&head->lock);
snum = smallest_rover;
- goto have_snum;
+ goto tb_found;
}
}
if (!inet_csk(sk)->icsk_af_ops->bind_conflict(sk, tb)) {
- spin_unlock(&head->lock);
snum = rover;
- goto have_snum;
+ goto tb_found;
}
goto next;
}
--
1.7.7.1
next prev parent reply other threads:[~2012-01-25 18:35 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-25 18:34 [PATCH 1/2] tcp: bind() fix autoselection to share ports Flavio Leitner
2012-01-25 18:34 ` Flavio Leitner [this message]
2012-01-25 18:36 ` [PATCH 2/2] tcp: bind() optimize port allocation Marcelo Leitner
2012-01-25 18:48 ` Eric Dumazet
2012-01-26 2:51 ` David Miller
2012-01-25 18:36 ` [PATCH 1/2] tcp: bind() fix autoselection to share ports Marcelo Leitner
2012-01-25 18:47 ` Eric Dumazet
2012-01-26 2:50 ` David Miller
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=1327516492-9045-2-git-send-email-fbl@redhat.com \
--to=fbl@redhat.com \
--cc=eric.dumazet@gmail.com \
--cc=mleitner@redhat.com \
--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).