Re: [PATCH] pipe: bound new-page copies by remaining iterator bytes

From: Christian Brauner

Date: Fri Oct 30 2026 - 12:31:33 EST


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.