[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHk-=wi=JeuB3aDX4yej=9SE-J6RR9LG28eRVfntkoQCPpHNpw@mail.gmail.com>
Date: Fri, 10 Feb 2023 12:51:21 -0800
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: Stefan Metzmacher <metze@...ba.org>
Cc: David Howells <dhowells@...hat.com>, Jens Axboe <axboe@...nel.dk>,
Linux API Mailing List <linux-api@...r.kernel.org>,
Samba Technical <samba-technical@...ts.samba.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Al Viro <viro@...iv.linux.org.uk>,
linux-fsdevel <linux-fsdevel@...r.kernel.org>,
io-uring <io-uring@...r.kernel.org>, linux-crypto@...r.kernel.org
Subject: Re: copy on write for splice() from file to pipe?
On Fri, Feb 10, 2023 at 12:45 PM Stefan Metzmacher <metze@...ba.org> wrote:
>
> I guess it would be easy to pass a flag (maybe SPLICE_F_FORCE_COPY)
> down to generic_file_splice_read() and let it create dedicated pages
> and use memcpy() from the page cache to the dedicated pages.
I really think you'd be much better off passing it off to the
*destination*, not the source.
The destination knows whether it needs to copy or not, and in the case
of at least networking, already has the copy option.
The destination might also already know whether it can use the data
synchronously, so that there isn't even any issue with "data may
change later".
In contrast, the source has no clue. It just knows "I'm a page cache
page". It would have to always copy.
Linus
Powered by blists - more mailing lists