Skip to content

drivers/char/mem: splice the zero page for /dev/zero and /dev/full

Kris Pan linux-fsdevel linux-mm lkml 2 versions – New

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest2 patches 0 repliesNew
  2. v11 patch 2 repliesSuperseded

Changes in v2 from the cover letter

- Move zero_pipe_buf_ops and splice_zeropage_into_pipe() from mm/shmem.c into fs/splice.c so they can be shared, instead of duplicating the boilerplate (Max Kellermann's suggestion).
- Rework splice_read_zero() to use the shared helper.

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2fs: move splice_zeropage_into_pipe() and zero_pipe_buf_ops to fs/splice.cfs/splice.c include/linux/splice.h mm/shmem.c+65 -450 replies
2/2drivers/char/mem: splice the zero page for /dev/zero and /dev/fulldrivers/char/mem.c+27 -20 replies

Reviews trailers per patch

1 of 2 patches has a Reviewed-by or Acked-by.

PatchMax Kellermann
1/2
2/2R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [PATCH v2 0/2] drivers/char/mem: splice the zero page for /dev/zero and /dev/full

Commit 1b057bd800c3 ("drivers/char/mem: implement splice() for /dev/zero, /dev/full") added splice support to /dev/zero and /dev/full using copy_splice_read(). The author noted that this could be optimized by pushing references to the global zero page instead of allocating and zeroing fresh pages for every pipe buffer, deferring it as "an optimization for another day".

This series implements that optimization by splicing the zero page into the pipe for /dev/zero and /dev/full, reusing the existing zero-page splice logic from mm/shmem.c.

v2:
- Move zero_pipe_buf_ops and splice_zeropage_into_pipe() from mm/shmem.c into fs/splice.c so they can be shared, instead of duplicating the boilerplate (Max Kellermann's suggestion).
- Rework splice_read_zero() to use the shared helper.

Kris Pan (2):
fs: move splice_zeropage_into_pipe() and zero_pipe_buf_ops to
fs/splice.c
drivers/char/mem: splice the zero page for /dev/zero and /dev/full

 drivers/char/mem.c     | 29 ++++++++++++++++++--
 fs/splice.c            | 62 ++++++++++++++++++++++++++++++++++++++++++
 include/linux/splice.h |  3 ++
 mm/shmem.c             | 45 ------------------------------
 4 files changed, 92 insertions(+), 47 deletions(-)
Signature · 1 line
2.43.0