Re: SO_REUSEPORT - can it be done in kernel?

Herbert Xu
2011-03-02T02:39:46Z

On Wed, Mar 02, 2011 at 03:00:03AM +0100, Eric Dumazet wrote:
> >
> > Think about it, a TCP socket cannot be used by a multi-threaded app
> > in a scalable way.
>
> Well...
>
> If you think about it, SO_REUSEPORT patch has exactly the same goal :

UDP is a datagram protocol, TCP is not.

Anyway, here is an alternate proposal. When a TCP socket transmits
for the first time (SYN or SYN-ACK), we pick a queue based on CPU and
store it in the socket. From then on we stick to that selection.

We would only allow changes if we can ensure that all transmitted
packets have left the queue. Or we just never change it like we
do now.

For datagram protocols we simply use the current CPU.

> We added RPS and XPS that works correctly if each socket is used by one
> thread. Maybe we need to add an user API or automatically detect a
> particular DGRAM socket is used by many different threads to :

No we don't need that for datagram protocols at all. By definition
there is no ordering guarantee across CPUs for datagram sockets.

Cheers,
--
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt