The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Oleg Nesterov <oleg@redhat.com>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Christian Brauner <brauner@kernel.org>,
	Breno Leitao <leitao@debian.org>,
	Mateusz Guzik <mjguzik@gmail.com>, Jens Axboe <axboe@kernel.dk>,
	Pavel Begunkov <asml.silence@gmail.com>,
	Alexander Viro <viro@zeniv.linux.org.uk>, Jan Kara <jack@suse.cz>,
	Alexey Gladkov <legion@kernel.org>,
	linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	io-uring@vger.kernel.org
Subject: Re: [PATCH v3 0/1] pipe: only enable the extra wake_up(rd_wait) for edge-triggered consumers
Date: Sun, 2 Aug 2026 16:56:31 +0200	[thread overview]
Message-ID: <am9an4HWPGaxmbcK@redhat.com> (raw)
In-Reply-To: <CAHk-=wg_PtU66p4iuvzCz13P_cDCfKg2OOuV-v6wq19ua8LyvQ@mail.gmail.com>

On 07/31, Linus Torvalds wrote:
>
> My argument is that IF we change this area, we should damn well do it
> right, and document it, and make it very very clear that the *ONLY*
> reason this exists is a user space legacy bug that took advantage of
> legacy kernel behavior, and that we are papering this over.

OK, I'll rename poll_usage/poll_et to ->pseudo_edgetrigger as Christian
suggests and update the comments as below:

struct pipe_inode_info:

	@pseudo_edgetrigger: has an EPOLLET consumer, enable per-write wakeups

pipe_poll:

	/*
	 * Legacy epoll(EPOLLET) users depend on historical per-write wakeups,
	 * see 3a34b13a88ca ("pipe: make pipe writes always wake up readers")
	 * and the ->pseudo_edgetrigger check in anon_pipe_write().
	 * Currently io_uring sets EPOLLET for multishot polls, so it gets the
	 * same behaviour.
	 */
	if ((filp->f_mode & FMODE_READ) &&
	    wait && (wait->_key & EPOLLET) &&
	    unlikely(!READ_ONCE(pipe->pseudo_edgetrigger)))
		WRITE_ONCE(pipe->pseudo_edgetrigger, true);

anon_pipe_write:

	 * ->pseudo_edgetrigger enables per-write wakeups, see pipe_poll()
	 */
	if (was_empty || READ_ONCE(pipe->pseudo_edgetrigger))
		wake_up_interruptible_sync_poll(&pipe->rd_wait, EPOLLIN | EPOLLRDNORM);

Will you agree? Or should I tweak the comments somehow to make it more clear
that the only reason is a user space legacy bug?

Oleg.


  reply	other threads:[~2026-08-02 14:56 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-30 14:11 [PATCH v3 0/1] pipe: only enable the extra wake_up(rd_wait) for edge-triggered consumers Oleg Nesterov
2026-07-30 14:12 ` [PATCH v3 1/1] " Oleg Nesterov
2026-07-30 14:26   ` Breno Leitao
2026-07-30 14:38     ` Oleg Nesterov
2026-07-30 20:01       ` Mateusz Guzik
2026-07-30 20:35         ` Oleg Nesterov
2026-07-31  0:14           ` Linus Torvalds
2026-07-31 10:45             ` Oleg Nesterov
2026-07-31 11:04               ` Oleg Nesterov
2026-07-31  8:27         ` Breno Leitao
2026-07-30 16:36 ` [PATCH v3 0/1] " Linus Torvalds
2026-07-30 18:55   ` Oleg Nesterov
2026-07-31 13:03     ` Christian Brauner
2026-07-31 14:07       ` Oleg Nesterov
2026-07-31 16:25         ` Linus Torvalds
2026-08-02 14:56           ` Oleg Nesterov [this message]
2026-08-02 16:53             ` Linus Torvalds

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=am9an4HWPGaxmbcK@redhat.com \
    --to=oleg@redhat.com \
    --cc=asml.silence@gmail.com \
    --cc=axboe@kernel.dk \
    --cc=brauner@kernel.org \
    --cc=io-uring@vger.kernel.org \
    --cc=jack@suse.cz \
    --cc=legion@kernel.org \
    --cc=leitao@debian.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mjguzik@gmail.com \
    --cc=torvalds@linux-foundation.org \
    --cc=viro@zeniv.linux.org.uk \
    /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