Re: [RFC -next 00/10] Add ZC notifications to splice and sendfile

Christoph Hellwig
2025-03-21T05:56:17Z

On Thu, Mar 20, 2025 at 11:23:57AM -0700, Joe Damato wrote:
> In my other message to Jens I proposed:
> - SPLICE_F_ZC for splice to generate zc completion notifications
> to the error queue
> - Modifying sendfile so that if SO_ZEROCOPY (which already exists)
> is set on a network socket, zc completion notifications are
> generated.
>
> In both cases no new system call is needed and both splice and
> sendfile become safer to use.
>
> At some point in the future a mechanism built on top of iouring
> introduced as new system calls (sendmsg2, sendfile2, splice2, etc)
> can be built.

I strongly disagree with this. This is spreading the broken
SO_ZEROCOPY to futher places outside the pure networking realm. Don't
do that.

It also doesn't help that more than 7 years after adding it,
SO_ZEROCOPY is still completely undocumented.

> > Because sendmsg should never have done that it certainly should not
> > spread beyond purely socket specific syscalls.
>
> I don't know the entire historical context, but I presume sendmsg
> did that because there was no other mechanism at the time.

At least aio had been around for about 15 years at the point, but
networking folks tend to be pretty insular and reinvent things.

> It seems like Jens suggested that plumbing this through for splice
> was a possibility, but sounds like you disagree.

Yes, very strongly.

> As mentioned above and in other messages, it seems like it is
> possible to improve the networking parts of splice (and therefore
> sendfile) to make them safer to use without introducing a new system
> call.
>
> Are you saying that you are against doing that, even if the code is
> network specific (but lives in fs/)?

Yes.

Please take the work and integrate it with the kiocb-based system
we use for all other in-kernel I/O that needs completion notifications
and which makes it trivial to integate with io_uring instead of
spreading an imcompatible and inferior event system.