From: Oleg Nesterov <oleg@redhat.com>
To: Christian Brauner <brauner@kernel.org>,
Nam Cao <namcao@linutronix.de>, Shuah Khan <shuah@kernel.org>,
Wei Yang <richard.weiyang@gmail.com>
Cc: Breno Leitao <leitao@debian.org>,
Mateusz Guzik <mjguzik@gmail.com>,
linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] selftests/epoll: add a regression test for pipe->poll_usage
Date: Wed, 29 Jul 2026 13:12:50 +0200 [thread overview]
Message-ID: <amngMt6ZdrehMNgu@redhat.com> (raw)
In-Reply-To: <amna1QtCtqll1LFj@redhat.com>
Sashiko suggests to check the results of pipe() and write() as well:
https://sashiko.dev/#/patchset/amna1QtCtqll1LFj%40redhat.com
Not sure this makes sense, but I'll send V2 just in case.
Oleg.
On 07/29, Oleg Nesterov wrote:
>
> pipe->poll_usage was added to ensure that edge-triggered epoll consumers
> get a wakeup on every write, even if the pipe was already non-empty.
> However, none of the existing epoll_wakeup_test cases cover this; the
> test suite passes even with WRITE_ONCE(pipe->poll_usage, true) removed.
>
> Add a test that writes twice to a pipe and verifies that epoll_wait with
> EPOLLET reports data each time. This covers the pipe-specific per-write
> wakeup behavior that edge-triggered consumers depend on.
>
> Signed-off-by: Oleg Nesterov <oleg@redhat.com>
> ---
> .../filesystems/epoll/epoll_wakeup_test.c | 24 +++++++++++++++++++
> 1 file changed, 24 insertions(+)
>
> diff --git a/tools/testing/selftests/filesystems/epoll/epoll_wakeup_test.c b/tools/testing/selftests/filesystems/epoll/epoll_wakeup_test.c
> index f6f1a7ff01b0..6ad7905ef95a 100644
> --- a/tools/testing/selftests/filesystems/epoll/epoll_wakeup_test.c
> +++ b/tools/testing/selftests/filesystems/epoll/epoll_wakeup_test.c
> @@ -3538,4 +3538,28 @@ TEST(epoll65)
> close(ctx.efd[1]);
> }
>
> +TEST(epoll66)
> +{
> + struct epoll_event event;
> + int pfd[2], efd, err;
> +
> + pipe(pfd);
> +
> + efd = epoll_create1(0);
> + ASSERT_GE(efd, 0);
> +
> + event.events = EPOLLIN | EPOLLET;
> + err = epoll_ctl(efd, EPOLL_CTL_ADD, pfd[0], &event);
> + ASSERT_EQ(err, 0);
> +
> + for (int i = 0; i < 2; ++i) {
> + write(pfd[1], "", 1);
> + EXPECT_EQ(epoll_wait(efd, &event, 1, 0), 1);
> + }
> +
> + close(pfd[0]);
> + close(pfd[1]);
> + close(efd);
> +}
> +
> TEST_HARNESS_MAIN
> --
> 2.52.0
>
prev parent reply other threads:[~2026-07-29 11:13 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-29 10:49 [PATCH] selftests/epoll: add a regression test for pipe->poll_usage Oleg Nesterov
2026-07-29 11:12 ` Oleg Nesterov [this message]
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=amngMt6ZdrehMNgu@redhat.com \
--to=oleg@redhat.com \
--cc=brauner@kernel.org \
--cc=leitao@debian.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=mjguzik@gmail.com \
--cc=namcao@linutronix.de \
--cc=richard.weiyang@gmail.com \
--cc=shuah@kernel.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