Re: [PATCH linux-next] perf/ring_buffer: Add EPOLLRDNORM flag for poll

From: Tao Chen
Date: Thu Mar 13 2025 - 13:04:58 EST


在 2025/3/13 18:05, Ingo Molnar 写道:

* Tao Chen <chen.dylane@xxxxxxxxx> wrote:

The poll man page says POLLRDNORM is equivalent to POLLIN,
so add EPOLLRDNORM here.

Signed-off-by: Tao Chen <chen.dylane@xxxxxxxxx>
---
kernel/events/ring_buffer.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/events/ring_buffer.c b/kernel/events/ring_buffer.c
index 59a52b1a1..5130b119d 100644
--- a/kernel/events/ring_buffer.c
+++ b/kernel/events/ring_buffer.c
@@ -19,7 +19,7 @@
static void perf_output_wakeup(struct perf_output_handle *handle)
{
- atomic_set(&handle->rb->poll, EPOLLIN);
+ atomic_set(&handle->rb->poll, EPOLLIN | EPOLLRDNORM);

So what does EPOLLRDNORM mean to begin with? There doesn't seem to be
separate/specific handling of it anywhere in the kernel that I can
see...


It seems that if user set pollfd with POLLRDNORM, perf_poll will not return until timeout even if perf_output_wakeup called, whereas POLLIN returns.

Thanks,

Ingo


--
Best Regards
Tao Chen