Re: [PATCH] drivers/char/mem: splice the zero page for /dev/zero and /dev/full
From: Max Kellermann
Date: Fri Aug 28 2026 - 14:03:17 EST
On Thu, Aug 20, 2026 at 9:15 AM Kris Pan <kris.pan@xxxxxxxxx> wrote:
>
> 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".
Hi Kris, thanks for picking up that idea. I'm not an expert on this
part of the kernel, but with my limited knowledge, it looks correct,
therefore:
Reviewed-by: Max Kellermann <max.kellermann@xxxxxxxxx>
Just one small thing: you copied code from mm/shmem.c; it's only some
minimal boilerplate, but for my taste, there should only be one copy
of that. But maybe even splice_zeropage_into_pipe() and
splice_read_zero() could be combined into one, as there is some
overlap.
--
Max Kellermann
Principal Architect
Hosting Technology
cm4all | Im Mediapark 6a | 50670 Köln | Germany
General information about the company can be found here:
https://www.cm4all.com/impressum
A member of the IONOS Group