Linux Perf Users
 help / color / mirror / Atom feed
From: Breno Leitao <leitao@debian.org>
To: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@redhat.com>,
	 Arnaldo Carvalho de Melo <acme@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	 Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Jiri Olsa <jolsa@kernel.org>, Ian Rogers <irogers@google.com>,
	 Adrian Hunter <adrian.hunter@intel.com>,
	James Clark <james.clark@linaro.org>,
	 linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org,
	kernel-team@meta.com
Subject: Re: [PATCH v2] perf bench: add --write-size option to sched pipe
Date: Tue, 26 May 2026 18:55:33 +0100	[thread overview]
Message-ID: <ahXWIrGvsC3_gIkC@gmail.com> (raw)
In-Reply-To: <ahUCyRwNPKV1VAZ8@google.com>

hello Namhyung,

On Mon, May 25, 2026 at 09:17:45PM +0000, Namhyung Kim wrote:
> On Thu, May 21, 2026 at 09:15:37AM -0700, Breno Leitao wrote:
> > +		ret = write(td->pipe_write, td->buf, write_size);
> > +		BUG_ON(ret < 0 || (unsigned int)ret != write_size);
> >  		ret = read_pipe(td);
> > -		BUG_ON(ret != sizeof(int));
> > +		BUG_ON(ret < 0 || (unsigned int)ret != write_size);
> 
> Is it possible to return smaller values than required due to signal or
> something?

I tested this on a VM with the patch applied, running the ping-pong with
write_size from 4 B up to 1 MiB, including multi-process and single-CPU
contention runs (millions of iterations). I observed zero short reads or short
writes.

Looking at fs/pipe.c, this matches the kernel behavior for this access pattern:
the bench has a single writer per pipe and the pipe capacity is set to
write_size, so the writer never has to sleep mid-write, and the kernel does a
sync wake of the reader only after the full payload is queued.

EINTR is also not reachable today because the bench installs no signal
handlers and nothing in the call chain delivers signals to the workers

At the same time, I understand the concern and If you'd still prefer defensive
handling (short-return loop + EINTR retry) I can add it in v3 — happy to either
way.

Thanks for the review,
--breno

  reply	other threads:[~2026-05-26 17:55 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-21 16:15 [PATCH v2] perf bench: add --write-size option to sched pipe Breno Leitao
2026-05-21 16:39 ` sashiko-bot
2026-05-21 17:12   ` Breno Leitao
2026-05-26  2:17 ` Namhyung Kim
2026-05-26 17:55   ` Breno Leitao [this message]
2026-05-27  5:22     ` Namhyung Kim
2026-05-27  9:03       ` Breno Leitao

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=ahXWIrGvsC3_gIkC@gmail.com \
    --to=leitao@debian.org \
    --cc=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=irogers@google.com \
    --cc=james.clark@linaro.org \
    --cc=jolsa@kernel.org \
    --cc=kernel-team@meta.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.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