Skip to content

RFC vmpslice support for zero-copy gifting of pages

Robert Jennings linux-fsdevel linux-mm lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest2 patches 3 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2vmsplice unmap gifted pages for recipientfs/splice.c include/linux/splice.h+25 -13 replies
2/2Add limited zero copy to vmsplicefs/splice.c+63 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [RFC PATCH 0/2] vmpslice support for zero-copy gifting of pages

This patch set would add the ability to move anonymous user pages from one process to another through vmsplice without copying data. Moving pages rather than copying is implemented for a narrow case in this RFC to meet the needs of QEMU's usage (below).

Among the restrictions the source address and destination addresses must be page aligned, the size argument must be a multiple of page size, and by the time the reader calls vmsplice, the page must no longer be mapped in the source. If a move is not possible the code transparently falls back to copying data.

This comes from work in QEMU[1] to migrate a VM from one QEMU instance to another with minimal down-time for the VM. This would allow for an update of the QEMU executable under the VM.

New flag usage
This introduces use of the SPLICE_F_MOVE flag for vmsplice, previously unused. Proposed usage is as follows:

Writer gifts pages to pipe, can not access original contents after gift:

    vmsplice(fd, iov, nr_segs, (SPLICE_F_GIFT | SPLICE_F_MOVE);
 Reader asks kernel to move pages from pipe to memory described by iovec:
    vmsplice(fd, iov, nr_segs, SPLICE_F_MOVE);

Moving pages rather than copying is implemented for a narrow case in this RFC to meet the needs of QEMU's usage. If a move is not possible the code transparently falls back to copying data.

For older kernels the SPLICE_F_MOVE would be ignored and a copy would occur.

[1] QEMU localhost live migration:

      http://lists.gnu.org/archive/html/qemu-devel/2013-06/msg02540.html
      http://lists.gnu.org/archive/html/qemu-devel/2013-06/msg02577.html

_______________________________________________________

RFC: vmsplice unmap gifted pages for recipient
RFC: Add limited zero copy to vmsplice

 fs/splice.c            | 88 +++++++++++++++++++++++++++++++++++++++++++++++++-
 include/linux/splice.h |  1 +
 2 files changed, 88 insertions(+), 1 deletion(-)
Signature · 7 lines
1.8.1.2

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>