Re: [PATCH v4] perf bench: add --write-size option to sched pipe
From: Breno Leitao
Date: Thu Jun 04 2026 - 11:24:35 EST
On Thu, Jun 04, 2026 at 10:21:00AM -0300, Arnaldo Carvalho de Melo wrote:
> On Wed, Jun 03, 2026 at 04:34:36PM -0700, Namhyung Kim wrote:
> > On Wed, Jun 03, 2026 at 03:35:07AM -0700, Breno Leitao wrote:
> > > The default ping-pong uses sizeof(int) (4 bytes) per iteration, which
> > > exercises only the pipe-buffer merge path and keeps allocation entirely
> > > out of the picture. That makes the bench a useful scheduler / context-
> > > switch latency probe but unable to surface anything from the pipe
> > > page-allocation hot path.
>
> > > Add a -s/--write-size option that sets the bytes written and read per
> > > ping-pong iteration. The buffer is allocated for each side via
> > > struct thread_data and replaces the on-stack int previously used. The
> > > default remains sizeof(int) so existing invocations are unchanged.
>
> > > With --write-size set above PAGE_SIZE the bench drives anon_pipe_write()
> > > through alloc_page() (or the bulk pre-alloc, if the relevant patch is
> > > applied), which is what we want when measuring pipe locking and page
> > > allocation work.
>
> > > The bench is a ping-pong: both sides call write() before read(), so a
> > > single write_size payload must fit entirely in the pipe buffer or both
> > > sides deadlock waiting for the other to drain. Resize the pipe via
> > > F_SETPIPE_SZ to match write_size (skipped at the sizeof(int) default),
> > > and error out cleanly when the request exceeds
> > > /proc/sys/fs/pipe-max-size.
>
> > > Signed-off-by: Breno Leitao <leitao@xxxxxxxxxx>
>
> > Acked-by: Namhyung Kim <namhyung@xxxxxxxxxx>
>
> Thanks, tested and applied:
Awesome. Thanks Arnaldo.