Re: SO_REUSEPORT - can it be done in kernel?

Tom Herbert
2011-03-02T07:12:32Z

On Tue, Mar 1, 2011 at 6:39 PM, Herbert Xu <herbert@gondor.apana.org.au> wrote:
> 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 :
>
In a sense. SO_RESUSEPORT for TCP is intended to provide a scalable
listener solution. Sharing an established socket is not very
efficient, something like a multiplexing socket layer on top of TCP
might be good.

> 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.
>
XPS does all this already.

> For datagram protocols we simply use the current CPU.
>
Probably need to set skb->ooo_okay (for UDP etc.) also so that XPS
will change queues.

Tom