]> git.baikalelectronics.ru Git - kernel.git/commit
tcp/dccp: better use of ephemeral ports in bind()
authorEric Dumazet <edumazet@google.com>
Fri, 12 Feb 2016 00:28:50 +0000 (16:28 -0800)
committerDavid S. Miller <davem@davemloft.net>
Fri, 12 Feb 2016 10:28:32 +0000 (05:28 -0500)
commita631dfdb5844fcc48b9435094f126cb84dce3e75
tree8b75745c913c33eba2707c3dc5fb0e312bfe3387
parentdbd91ae1a5446ccf80ff15493738efd0820532d4
tcp/dccp: better use of ephemeral ports in bind()

Implement strategy used in __inet_hash_connect() in opposite way :

Try to find a candidate using odd ports, then fallback to even ports.

We no longer disable BH for whole traversal, but one bucket at a time.
We also use cond_resched() to yield cpu to other tasks if needed.

I removed one indentation level and tried to mirror the loop we have
in __inet_hash_connect() and variable names to ease code maintenance.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv4/inet_connection_sock.c