From: Eric Dumazet <eric.dumazet@gmail.com>
To: David Miller <davem@davemloft.net>
Cc: netdev@vger.kernel.org, ncardwell@google.com,
therbert@google.com, ycheng@google.com, hkchu@google.com,
maze@google.com, maheshb@google.com, ilpo.jarvinen@helsinki.fi,
nanditad@google.com
Subject: Re: [PATCH] tcp: allow splice() to build full TSO packets
Date: Tue, 03 Apr 2012 23:31:29 +0200 [thread overview]
Message-ID: <1333488689.18626.331.camel@edumazet-glaptop> (raw)
In-Reply-To: <20120403.172126.672236532461758456.davem@davemloft.net>
On Tue, 2012-04-03 at 17:21 -0400, David Miller wrote:
> From: Eric Dumazet <eric.dumazet@gmail.com>
> Date: Tue, 03 Apr 2012 21:37:01 +0200
>
> > vmsplice()/splice(pipe, socket) call do_tcp_sendpages() one page at a
> > time, adding at most 4096 bytes to an skb. (assuming PAGE_SIZE=4096)
> >
> > The call to tcp_push() at the end of do_tcp_sendpages() forces an
> > immediate xmit when pipe is not already filled, and tso_fragment() try
> > to split these skb to MSS multiples.
> >
> > 4096 bytes are usually split in a skb with 2 MSS, and a remaining
> > sub-mss skb (assuming MTU=1500)
>
> Interesting.
>
> But why doesn't TCP_NAGLE_CORK save us? That gets passed down into
> the push pending frames logic when MSG_MORE is specified.
>
> As far as I can tell, the combination of TCP_NAGLE_CORK and the TSO
> deferral logic should do the right thing here.
>
> Obviously you see different behavior, but why?
>
> Also, by eliding the tcp_push() call you are introducing other side
> effects:
>
> 1) we won't do the tcp_mark_push logic
>
> 2) we don't set the URG seq
>
> I think #2 can never happen in the vmsplice/splice path, but #1 might
> matter.
>
> That's why I want to concentrate on why the tcp_push() path doesn't
> behave properly when MSG_MORE is set.
It behaves properly I think, but in the tcp_sendmsg() perspective only.
The code in tcp_sendmsg() and do_tcp_sendpages() is similar (actually
probably copy/pasted) but the thing is tcp_sendmsg() is called once per
sendmsg() call (and the push logic is OK at the end of it), while a
single splice() system call can call do_tcp_sendpages() 16 times (or
even more if pipe buffer was extended by fcntl(F_SETPIPE_SZ))
Maybe a real fix would be to call do_tcp_sendpages() exactly once, but I
tried this today and found needed surgery was complex). Also this would
lock socket for a long period and could add latencies because of backlog
processing.
next prev parent reply other threads:[~2012-04-03 21:31 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-04-03 19:37 [PATCH] tcp: allow splice() to build full TSO packets Eric Dumazet
2012-04-03 21:21 ` David Miller
2012-04-03 21:31 ` Eric Dumazet [this message]
2012-04-03 21:36 ` David Miller
2012-04-03 22:50 ` David Miller
2012-04-04 6:15 ` Eric Dumazet
2012-04-04 6:20 ` David Miller
2012-04-05 13:05 ` Eric Dumazet
2012-04-05 23:05 ` David Miller
2012-04-06 1:59 ` Eric Dumazet
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1333488689.18626.331.camel@edumazet-glaptop \
--to=eric.dumazet@gmail.com \
--cc=davem@davemloft.net \
--cc=hkchu@google.com \
--cc=ilpo.jarvinen@helsinki.fi \
--cc=maheshb@google.com \
--cc=maze@google.com \
--cc=nanditad@google.com \
--cc=ncardwell@google.com \
--cc=netdev@vger.kernel.org \
--cc=therbert@google.com \
--cc=ycheng@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox