Re: [PATCH v3] perf bench: add --write-size option to sched pipe

From: Breno Leitao

Date: Wed Jun 03 2026 - 06:32:24 EST


On Tue, Jun 02, 2026 at 10:22:02PM -0700, Namhyung Kim wrote:
> On Mon, Jun 01, 2026 at 04:10:29AM -0700, Breno Leitao wrote:
> > Hello Namhyung,
> >
> > On Wed, May 27, 2026 at 10:31:10AM -0700, Namhyung Kim wrote:
> > > On Wed, May 27, 2026 at 06:42:59AM -0700, Breno Leitao wrote:
> > > > +static inline int write_pipe(struct thread_data *td)
> > > > +{
> > > > + unsigned int done = 0;
> > > > + int ret;
> > > > +
> > > > + while (done < write_size) {
> > > > + ret = write(td->pipe_write, td->buf + done, write_size - done);
> > > > + if (ret < 0) {
> > > > + if (nonblocking && errno == EWOULDBLOCK)
> > > > + continue;
> > >
> > > Don't we also need the blocking part?
> >
> > Just to make sure I'm reading this right: do you mean the writer
> > should epoll_wait() on EPOLLOUT before retrying (symmetric to what
> > read_pipe() does for EPOLLIN), so we sleep until the pipe drains
> > instead of spinning on EWOULDBLOCK? Or are you pointing at something
> > else — e.g. behavior in the blocking (!nonblocking) path?
>
> I simply meant if it needs to check EINTR if !nonblocking.

Ack, thanks for clarifying - I get what you meant now. A blocking
read()/write() can return -1/EINTR if a signal is delivered while it's
parked in the syscall (e.g. the user hits Ctrl-C), so I'll just
continue on errno == EINTR in both helpers.

I'll respin with that, and also address the "medium" issue Sashiko
flagged on the same write path: instead of busy-spinning on
EWOULDBLOCK in non-blocking mode, the writer now poll()s on POLLOUT and
only retries once the peer has drained the pipe.

Thanks,
--breno