]> git.karo-electronics.de Git - karo-tx-linux.git/commit
udp: inuse checks can quit early for reuseport
authorEric Garver <e@erig.me>
Fri, 6 Jan 2017 01:22:36 +0000 (20:22 -0500)
committerDavid S. Miller <davem@davemloft.net>
Sat, 7 Jan 2017 01:56:48 +0000 (20:56 -0500)
commitdf560056d960a3e164c179d89770d5a51b798537
treec7ef7484e35828d01338bcb4b715733b1f2e5498
parent89eb9835b2657a902adb8d5e31f721a8004726b5
udp: inuse checks can quit early for reuseport

UDP lib inuse checks will walk the entire hash bucket to check if the
portaddr is in use. In the case of reuseport we can stop searching when
we find a matching reuseport.

On a 16-core VM a test program that spawns 16 threads that each bind to
1024 sockets (one per 10ms) takes 1m45s. With this change it takes 11s.

Also add a cond_resched() when the port is not specified.

Signed-off-by: Eric Garver <e@erig.me>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv4/udp.c