On Thu, 2016-04-28 at 10:23 -0700, Alexei Starovoitov wrote: > On Wed, Apr 27, 2016 at 10:25:46PM -0700, Eric Dumazet wrote: > > Most of TCP stack assumed it was running from BH handler. > > > > This is great for most things, as TCP behavior is very sensitive > > to scheduling artifacts. > > > > However, the prequeue and backlog processing are problematic, > > as they need to be flushed with BH being blocked. > > > > To cope with modern needs, TCP sockets have big sk_rcvbuf values, > > in the order of 16 MB. > > This means that backlog can hold thousands of packets, and things > > like TCP coalescing or collapsing on this amount of packets can > > lead to insane latency spikes, since BH are blocked for too long. > > > > It is time to make UDP/TCP stacks preemptible. > > > > Note that fast path still runs from BH handler. > > this looks pretty awesome.
Yes, I am pretty excited ;) > the change will make the backlog run in bh enabled, so that one > large flow reciever will not penalize the rest of the system, right? Not only large flows, but flows with losses/reorders. Typically many flows are in this case when a congestion collapse happens. > but you're saying that prequeue is also expensive, but not touched > by this patchset? was it addressed by your eariler patch? > Or more work still tbd? prequeue is handled by "[2/6] tcp: do not block bh during prequeue processing" Note that I also sent a patch earlier (("tcp: give prequeue mode some care")) to control max size of prequeue to 32 packets. > I'm just trying to understand more about tcp stack. > Sure ;) I also have a patch to add scheduling point in sendmsg() (ie : draining the backlog if not empty) for each new skb added to the write queue. Since each skb is about 64KB (with GSO/TSO), it means an application no longer will hold the socket lock too long, even when doing a write()/sendmsg() of say 8 MB at once ;)