Re: [PATCH 0/3] vmsplice: make vmsplice a trivial wrapper for preadv2/pwritev2
From: "David Hildenbrand (Arm)" <david@kernel.org>
Date: 2026-06-02 08:25:11
Also in:
linux-fsdevel, linux-mm, linux-patches, lkml, netdev
On 6/2/26 02:28, Andrew Morton wrote:
On Mon, 1 Jun 2026 16:04:55 -0400 Steven Rostedt [off-list ref] wrote:quoted
On Mon, 1 Jun 2026 18:33:25 +0100 Al Viro [off-list ref] wrote:quoted
FUSE might be interesting - fuse_dev_splice_read() and its ilk. Communications between the kernel and fuse server at least used to seriously want that, so that would be one place to look for unhappy userland... splice-related logics in fs/fuse/dev.c is interesting; another place like this is kernel/trace/, but I'm less familiar with that one. rostedt Cc'd (miklos already had been)Thanks for the Cc. The tracing ring buffer was specifically made to be used by splice and the libtracefs has a lot of code to use it as well. As reading the ring buffer literally swaps out the write portion with a blank read portion, that portion (sub-buffer) is used to be directly fed into splice, providing a zero-copy of the trace data from the write of the event to going into a file. trace-cmd defaults to using splice to copy the tracing ring buffer directly into files to avoid as much copying during live recordings as possible. Whatever changes we make, I would like to make sure there's no regressions in performance of trace-cmd record.Well yes, The patchset seems sensible from a quality POV. But to make a decision we should first have a decent understanding of its downside impact.
I guess most (all?) of us ... dislike ... vmsplice(), so trying to remove it entirely is certainly very appealing ...
I haven't seen a description of that impact in the discussion thus far. And that description is owed, please. I assume a small number of specialized applications are using vmsplice() to great effect? What are those applications? What is the impact of this change?
I did some digging, and the kernel crypto API documents using splice/vmsplice for zero-copy[1] and libkcapi [2]. I did not find performance numbers, how much vmsplice/splice actually gives us. Playing with the kcapi-speed tool [3] (specifying --vmsplice vs. --sendmsg) doesn't really reveal a big difference at least on my notebook. Not sure if the parameters I specify are reasonable. I don't know whether downgrading vmsplice to preadv2/pwritev2 would perform significantly worse than sendmsg ... and I don't know what the default would usually be (default to vmsplice or sendmsg). I might try finding some time to play with it more, but I doubt it, so if anybody else has time ... :) I'll note that we have a bunch of selftests (mostly around COW handling) that rely on vmsplice to test R/O pinning behavior. For R/W pinning, we can use iouring fixed buffers easily. The only alternative for R/O pinning is using the gup_test infrastructure that needs to be compiled into the kernel, unfortunately ... So we'll have to adjust some tests there to use a different interface. I'm sure I can find someone to work on that once this change here landed and doesn't have to be yanked immediately again. [1] https://www.kernel.org/doc/html/latest/crypto/userspace-if.html [2] https://github.com/smuellerDD/libkcapi/blob/master/lib/kcapi-kernel-if.c [3] https://github.com/smuellerDD/libkcapi/tree/master/speed-test -- Cheers, David