Re: [PATCH] pipe: bound new-page copies by remaining iterator bytes
From: Mateusz Guzik
Date: Fri Oct 30 2026 - 14:34:21 EST
On Fri, Oct 30, 2026 at 5:31 PM Christian Brauner <brauner@xxxxxxxxxx> wrote:
>
> On Wed, Oct 15, 2026 at 04:53:26PM +0800, Li Qiang wrote:
> > anon_pipe_write() requests PAGE_SIZE bytes even when fewer bytes
> > remain in the source iterator. This causes copy_page_from_iter()
> > to perform an unnecessary extra iteration after copying all data.
>
> This is an optimization not a fix. copy_page_from_iter() already clamps
> to the iterator count, so nothing is copied twice. What you save is one
> kmap round trip.
I know a guy who promised he would write the patch to avoid the
multiple SMAP trips for read and write side (it's not me).
It is unclear if the thing will materialize, let alone for the next merge cycle.
I think the patch proposed here is ok enough to go in regardless, even
if it becomes obsolete in few weeks.