]> git.baikalelectronics.ru Git - kernel.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)
commit86434bd4339aca09a290f552d6e06425934d5c02
treec7ef7484e35828d01338bcb4b715733b1f2e5498
parentee0b2b7075b24267c989c5815edd6cf13fae3492
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