Skip to contentSkip to conversation

perf/ring_buffer: Add EPOLLRDNORM flag for poll

PATCH Applied Tao Chen 2 participants 2 messages Mar 14, 2025 – Mar 17, 2025 perf events

lore
Share & tools
lore

Tao Chen

author
#0 lore raw

PATCH v2 1/1 perf/ring_buffer: Add EPOLLRDNORM flag for poll

The poll man page says POLLRDNORM is equivalent to POLLIN. For poll, it seems that if user sets pollfd with POLLRDNORM in userspace, perf_poll will not return until timeout even if perf_output_wakeup called, whereas POLLIN returns.

Fixes 76369139ceb9 ("perf: Split up buffer handling from core code")
---
 kernel/events/ring_buffer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Change list:
- v1 -> v2:
- add changelog
- v1
https://lore.kernel.org/all/[email protected]

kernel/events/ring_buffer.c +1 -1
index 59a52b1a1..5130b119d 100644
@@ -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);
 
 	handle->event->pending_wakeup = 1;
 
Signature · 1 line
2.43.0
merge bot Applied
#1 lore raw

[tip: perf/core] perf/ring_buffer: Allow the EPOLLRDNORM flag for poll

The following commit has been merged into the perf/core branch of tip:

The following commit has been merged into the perf/core branch of tip:

Commit-ID:     c96fff391c095c11dc87dab35be72dee7d217cde
Gitweb:        https://git.kernel.org/tip/c96fff391c095c11dc87dab35be72dee7d217cde
Author:        Tao Chen <[email protected]>
AuthorDate:    Fri, 14 Mar 2025 11:00:36 +08:00
Committer:     Ingo Molnar <[email protected]>
CommitterDate: Mon, 17 Mar 2025 08:31:04 +01:00

perf/ring_buffer: Allow the EPOLLRDNORM flag for poll

The poll man page says POLLRDNORM is equivalent to POLLIN. For poll(), it seems that if user sets pollfd with POLLRDNORM in userspace, perf_poll will not return until timeout even if perf_output_wakeup called, whereas POLLIN returns.

Fixes 76369139ceb9 ("perf: Split up buffer handling from core code")
Cc Peter Zijlstra <[email protected]>
Cc Arnaldo Carvalho de Melo <[email protected]>
Cc "H. Peter Anvin" <[email protected]>
Cc Linus Torvalds <[email protected]>
---
 kernel/events/ring_buffer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/events/ring_buffer.c +1 -1
index 59a52b1..5130b11 100644
@@ -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);
 
 	handle->event->pending_wakeup = 1;