Thread (64 messages) 64 messages, 10 authors, 2023-02-20

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

flat view

From: Linus Torvalds <torvalds@linux-foundation.org>
Date: 2023-02-10 20:51:46
Also in: io-uring, linux-crypto, linux-fsdevel, lkml

On Fri, Feb 10, 2023 at 12:45 PM Stefan Metzmacher [off-list ref] 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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help