Re: [PATCH RFC 3/3] fs/pipe: copy a run of anonymous buffers in one user access section
From: Chris Down
Date: Tue Nov 17 2026 - 04:04:43 EST
Hi Breno,
Breno Leitao writes:
The numbers below come from an earlier version of this patch, which did
the copies in fs/pipe.c and left runs of a single buffer to the old
loop. Throughput change, median of 2 boots x 5 runs, SMAP on:
I timed a single read() from a pipe that was already full of anonymous
buffers, on an i9-14900HX in a 2 CPU KVM guest:
read size base this base, nosmap this, nosmap
4 KiB 175ns 181ns 152ns 155ns
64 KiB 2123ns 2061ns 1971ns 2070ns
1 MiB 49.6us 49.0us 46.4us 48.3us
(nosmap here being clearcpuid=smap.)
So on this CPU the 16 STAC/CLAC pairs in a 64 KiB read cost about 150ns,
and this patch gets back about 60ns of that. But with SMAP off this patch
is about 100ns slower for the same read. So the batched path seems to
cost more than the old loop, and only comes out ahead where STAC/CLAC
are expensive. I haven't looked into where that comes from.
On CPUs where they're cheap, like the later Zen parts Linus mentioned in
[1], this may well be a loss.
It would be good for the changelog to have numbers with some
clearcpuid=smap runs to compare with, and preferably on a few machine
types.
[1] https://lore.kernel.org/all/CAHk-=wiTN=1Sm5DVnXDtQ-tSiPuz-7QVpgP2vt6LgaEnhbubfw@xxxxxxxxxxxxxx/
Thanks!
Chris