mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2 0/2] drivers/char/mem: splice the zero page for /dev/zero and /dev/full
@ 2026-08-29  4:37 Kris Pan
  2026-08-29  4:37 ` [PATCH v2 1/2] fs: move splice_zeropage_into_pipe() and zero_pipe_buf_ops to fs/splice.c Kris Pan
  2026-08-29  4:37 ` [PATCH v2 2/2] drivers/char/mem: splice the zero page for /dev/zero and /dev/full Kris Pan
  0 siblings, 2 replies; 3+ messages in thread
From: Kris Pan @ 2026-08-29  4:37 UTC (permalink / raw)
  To: gregkh
  Cc: akpm, hughd, viro, brauner, arnd, max.kellermann, linux-fsdevel,
	linux-mm, linux-kernel, Kris Pan

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(-)

-- 
2.43.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-08-29  4:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-08-29  4:37 [PATCH v2 0/2] drivers/char/mem: splice the zero page for /dev/zero and /dev/full Kris Pan
2026-08-29  4:37 ` [PATCH v2 1/2] fs: move splice_zeropage_into_pipe() and zero_pipe_buf_ops to fs/splice.c Kris Pan
2026-08-29  4:37 ` [PATCH v2 2/2] drivers/char/mem: splice the zero page for /dev/zero and /dev/full Kris Pan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®