Re: AF_UNIX/zerocopy/pipe/vmsplice/splice vs FOLL_PIN
From: Christoph Hellwig
Date: Mon Jun 23 2025 - 09:55:34 EST
On Mon, May 12, 2025 at 03:51:30PM +0100, David Howells wrote:
> I'm looking at how to make sendmsg() handle page pinning - and also working
> towards supporting the page refcount eventually being removed and only being
> available with certain memory types.
Yes, that would be great.
> The question is what should happen here to a memory span for which the network
> layer or pipe driver is not allowed to take reference, but rather must call a
> destructor? Particularly if, say, it's just a small part of a larger span.
What is a "span" in this context? In general splice unlike direct I/O
relies on page reference counts inside the splice machinery. But that is
configurable through the pipe_buf_operations. So if you want something
to be handled by splice that does not use simple page refcounts you need
special pipe_buf_operations for it. And you'd better have a really good
use case for this to be worthwhile.
> And then there's vmsplice(). The same goes for vmsplice() to AF_UNIX or to a
> pipe. That should also pin memory. It may also be possible to vmsplice a
> pinned page into the target process's VM or a page from a memory span with
> some other type of destruction. I don't suppose we can deprecate vmsplice()?
You'll need a longterm pin for vmsplice. I'd love to deprecate it,
but I doubt it's going to go away any time soon if ever.