At 2PM +0300 on 23/09/13 you Timo Sirainen wrote:
[SO_REUSEPORT]
This feature originated from BSDs that had it long time ago.
SO_REUSEPORT was introduced in 4.4 BSD, but the new Linux feature which includes load balancing is something rather different. It's a pity the Linux (Google?) people didn't choose a different name for it.
4.4's SO_REUSEPORT just allows multiple (pre-TIME_WAIT) sockets to bind to the same local address:port. It was introduced for the benefit of multicast apps; AFAIK its only significant non-multicast use is in ftpd, which in active mode has to create lots of outgoing sockets originating from the same source address:port. The question of load balancing obviously doesn't apply here, since the connections are initiated by the server.
With a 4.4 implementation, setting SO_REUSEPORT is actively bad for something like Dovecot: while all the sockets will be allowed to bind, connections will only be passed to the first until that is closed, then to the next, and so on. Of the BSDs, DragonFly has implemented the Linux semantics (including a fix for the bug mentioned in your commit message); I believe the others, including OSX, are still using the 4.4 code.
Ben