mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [RFC/PATCH for-perf-urgent] perf/core: Change to POLLERR for pinned events with error
@ 2025-04-22 22:33 Namhyung Kim
  2025-04-23  7:46 ` [tip: perf/urgent] " tip-bot2 for Namhyung Kim
  0 siblings, 1 reply; 2+ messages in thread
From: Namhyung Kim @ 2025-04-22 22:33 UTC (permalink / raw)
  To: Peter Zijlstra, Ingo Molnar
  Cc: Kan Liang, Mark Rutland, Alexander Shishkin,
	Arnaldo Carvalho de Melo, LKML, Gabriel Marin

The commit f4b07fd62d4d11d5 ("perf/core: Use POLLHUP for pinned events
in error") started to emit POLLHUP for pinned events in an error state.

But the POLLHUP is also used to signal events that the attached task is
terminated.  To distinguish pinned per-task events in the error state
it would need to check if the task is live.

If we can change it to POLLERR it should be clear.

Suggested-by: Gabriel Marin <gmx@google.com>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
 kernel/events/core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/events/core.c b/kernel/events/core.c
index e93c195659140d30..95e703891b24f8fc 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -3943,7 +3943,7 @@ static int merge_sched_in(struct perf_event *event, void *data)
 			perf_event_set_state(event, PERF_EVENT_STATE_ERROR);
 
 			if (*perf_event_fasync(event))
-				event->pending_kill = POLL_HUP;
+				event->pending_kill = POLL_ERR;
 
 			perf_event_wakeup(event);
 		} else {
@@ -6075,7 +6075,7 @@ static __poll_t perf_poll(struct file *file, poll_table *wait)
 
 	if (unlikely(READ_ONCE(event->state) == PERF_EVENT_STATE_ERROR &&
 		     event->attr.pinned))
-		return events;
+		return EPOLLERR;
 
 	/*
 	 * Pin the event->rb by taking event->mmap_mutex; otherwise
-- 
2.49.0.805.g082f7c87e0-goog


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-04-23  7:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-04-22 22:33 [RFC/PATCH for-perf-urgent] perf/core: Change to POLLERR for pinned events with error Namhyung Kim
2025-04-23  7:46 ` [tip: perf/urgent] " tip-bot2 for Namhyung Kim

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®