copy on write for splice() from file to pipe?

Herbert Xu herbert at gondor.apana.org.au
Mon Feb 13 09:28:16 UTC 2023


Linus Torvalds <torvalds at linux-foundation.org> wrote:
>
> Ok, so I decided to try to take a look.
> 
> Somebody who actually does networking (and drivers in particular)
> should probably check this, but it *looks* like the IPv4 TCP case
> (just to pick the ony I looked at) gores through
> tcp_sendpage_locked(), which does
> 
>        if (!(sk->sk_route_caps & NETIF_F_SG))
>                return sock_no_sendpage_locked(sk, page, offset, size, flags);
> 
> which basically says "if you can't handle fragmented socket buffers,
> do that 'no_sendpage' case".
> 
> So that will basically end up just falling back to a kernel
> 'sendmsg()', which does a copy and then it's stable.
> 
> But for the networks that *can* handle fragmented socket buffers, it
> then calls do_tcp_sendpages() instead, which just creates a skb
> fragment of the page (with tcp_build_frag()).
> 
> I wonder if that case should just require NETIF_F_HW_CSUM?

NETIF_F_SG already depends on checksum offload (either via
NETIF_F_HW_CSUM or something else that is equivalent).

So are you guys just imagining non-existant problems?

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



More information about the samba-technical mailing list