Linux block layer
 help / color / mirror / Atom feed
From: Chris Down <chris@chrisdown.name>
To: Breno Leitao <leitao@debian.org>
Cc: Thomas Gleixner <tglx@kernel.org>, Ingo Molnar <mingo@redhat.com>,
	Borislav Petkov <bp@alien8.de>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	x86@kernel.org, "H. Peter Anvin" <hpa@zytor.com>,
	Alexander Viro <viro@zeniv.linux.org.uk>,
	Christian Brauner <brauner@kernel.org>, Jan Kara <jack@suse.cz>,
	Andrew Morton <akpm@linux-foundation.org>,
	linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	linux-block@vger.kernel.org, kernel-team@meta.com,
	Mateusz Guzik <mjguzik@gmail.com>
Subject: Re: [PATCH RFC 3/3] fs/pipe: copy a run of anonymous buffers in one user access section
Date: Tue, 17 Nov 2026 01:04:31 -0800	[thread overview]
Message-ID: <avwYn2KugKhjYxNh@chrisdown.name> (raw)
In-Reply-To: <20261113-pipe-pool-regression-smap-v1-3-b0dc69558ab3@debian.org>

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@mail.gmail.com/

Thanks!

Chris

  reply	other threads:[~2026-11-17  9:04 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-13 11:51 [PATCH RFC 0/3] fs/pipe: copy a run of pipe buffers in one user access section Breno Leitao
2026-11-13 11:51 ` [PATCH RFC 1/3] x86/uaccess: Split the STAC/CLAC out of copy_user_generic() Breno Leitao
2026-11-13 11:51 ` [PATCH RFC 2/3] iov_iter: add copy_bvecs_to_iter_full() Breno Leitao
2026-11-13 11:51 ` [PATCH RFC 3/3] fs/pipe: copy a run of anonymous buffers in one user access section Breno Leitao
2026-11-17  9:04   ` Chris Down [this message]
2026-11-17  9:04 ` [PATCH RFC 0/3] fs/pipe: copy a run of pipe " Chris Down

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=avwYn2KugKhjYxNh@chrisdown.name \
    --to=chris@chrisdown.name \
    --cc=akpm@linux-foundation.org \
    --cc=bp@alien8.de \
    --cc=brauner@kernel.org \
    --cc=dave.hansen@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=jack@suse.cz \
    --cc=kernel-team@meta.com \
    --cc=leitao@debian.org \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=mjguzik@gmail.com \
    --cc=tglx@kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox