[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250210183629.GJ32480@redhat.com>
Date: Mon, 10 Feb 2025 19:36:29 +0100
From: Oleg Nesterov <oleg@...hat.com>
To: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: K Prateek Nayak <kprateek.nayak@....com>,
Christian Brauner <brauner@...nel.org>,
Jeff Layton <jlayton@...nel.org>,
David Howells <dhowells@...hat.com>,
"Gautham R. Shenoy" <gautham.shenoy@....com>,
Mateusz Guzik <mjguzik@...il.com>,
Neeraj Upadhyay <Neeraj.Upadhyay@....com>,
Oliver Sang <oliver.sang@...el.com>,
Swapnil Sapkal <swapnil.sapkal@....com>,
WangYuli <wangyuli@...ontech.com>, linux-fsdevel@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/2] pipe: change pipe_write() to never add a zero-sized
buffer
On 02/10, Linus Torvalds wrote:
>
> On Mon, 10 Feb 2025 at 09:22, Oleg Nesterov <oleg@...hat.com> wrote:
> >
> > + int avail = PAGE_SIZE - offset;
> >
> > - if ((buf->flags & PIPE_BUF_FLAG_CAN_MERGE) &&
> > - offset + chars <= PAGE_SIZE) {
> > + if (avail && (buf->flags & PIPE_BUF_FLAG_CAN_MERGE)) {
> > ret = pipe_buf_confirm(pipe, buf);
> > if (ret)
> > goto out;
> >
> > + chars = min_t(ssize_t, chars, avail);
>
> If I read this correctly, this patch is horribly broken.
>
> You can't do partial writes. Pipes have one very core atomicity
> guarantee: from the man-pages:
>
> PIPE_BUF
> POSIX.1 says that writes of less than PIPE_BUF bytes must be
> atomic:
Ah, I didn't know!
Thanks for your explanation and the quick NACK!
> Maybe we should add a comment somewhere about this.
Agreed. It would certainly help the ignorant readers like me ;)
So I guess that the "goto again" logic in sender/receiver in
tools/perf/bench/sched-messaging.c is currently pointless,
DATASIZE == 100 < PIPE_BUF.
Thanks.
Oleg.
Powered by blists - more mailing lists