[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHk-=wg2Mb4ZgRuBthw6O0KLhZNksGBQNs73386Gdg4gHny=XA@mail.gmail.com>
Date: Fri, 10 Feb 2023 11:29:31 -0800
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: Andy Lutomirski <luto@...nel.org>
Cc: Dave Chinner <david@...morbit.com>,
Matthew Wilcox <willy@...radead.org>,
Stefan Metzmacher <metze@...ba.org>,
Jens Axboe <axboe@...nel.dk>,
linux-fsdevel <linux-fsdevel@...r.kernel.org>,
Linux API Mailing List <linux-api@...r.kernel.org>,
io-uring <io-uring@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Al Viro <viro@...iv.linux.org.uk>,
Samba Technical <samba-technical@...ts.samba.org>
Subject: Re: copy on write for splice() from file to pipe?
On Fri, Feb 10, 2023 at 11:18 AM Linus Torvalds
<torvalds@...ux-foundation.org> wrote:
>
> - and finally, I do think it might make sense for the networking
> people to look at how the networking side works with 'sendpage()'.
Put another way: I do not believe that it is at all fundamental that
you can't send data from an changing source over the network. That's
likely _particularly_ true of the people who care the most, and who
already have network cards that do a lot of the heavy lifting for you.
So why spend a lot of effort to stabilize the data, if it's not
needed, when the primary users of it would likely not want that
performance hit and extra work in the first place?
Then making that "strict mode" be the only mode going forward and just
disallowing people from doing the simple thing sounds particularly
wrong.
For example, it may *literally* be that the IPV4 TCP case could be
fixed with something trivial like this
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -1134,7 +1134,8 @@ EXPORT_SYMBOL_GPL(do_tcp_sendpages);
int tcp_sendpage_locked(struct sock *sk, struct page *page, int offset,
size_t size, int flags)
{
- if (!(sk->sk_route_caps & NETIF_F_SG))
+ if (!(sk->sk_route_caps & NETIF_F_SG) ||
+ !(sk->sk_route_caps & (NETIF_F_HW_CSUM | NETIF_F_IP_CSUM)))
return sock_no_sendpage_locked(sk, page, offset, size, flags);
tcp_rate_check_app_limited(sk); /* is sending application-limited? */
which would basically make hardware that can't deal with the data
changing under it just fall back to the "safe and slow" model on its
own.
But then hardware that doesn't care would "just work".
See what I'm saying? The above patch may be garbage because I don't
understand the network driver rules fully, so don't take the above as
some kind of "last word" on this AT ALL. But I'm just saying that
requiring stable sources doesn't necessarily make any sense at all.
Linus
Powered by blists - more mailing lists