On Mon, 2016-04-18 at 20:18 -0700, Martin KaFai Lau wrote: > On Mon, Apr 18, 2016 at 07:50:41PM -0700, Eric Dumazet wrote: > > I believe it is slightly wrong (to do the goto new_segment if there is > > no data to send) > Aha. Thanks for pointing it out. > > > > > I would instead use this fast path, doing the test _when_ we already > > have an skb to test for. > The v1 was doing a check in the loop but the feedback was, instead > of doing this unlikely(test) repeatedly in the loop, do it before > entering the loop and do a goto new_segment if needed. > > I agree that doing it in the loop is easier to follow/read > and checking TCP_SKB_CB(skb)->eor is cheaper than my v1. > I will respin with your suggestion.
I do not remember the suggestion. It is better to do the test in the loop, as you could have multiple threads doing a sendmsg() on the same socket, and eventually sleeping in sk_stream_wait_memory() A bit convoluted, but who knows what can be done by some applications ;)