Re: [PATCH v1] perf test task-exit: Fix POLLHUP busy-loop race waiting for SIGCHLD

From: Namhyung Kim

Date: Sat Nov 14 2026 - 23:13:07 EST


On Sun, 25 Oct 2026 14:49:28 -0700, Ian Rogers wrote:
> In the kernel's do_exit(), perf_event_exit_task() runs before exit_mm()
> and exit_notify() (which delivers SIGCHLD to the parent). Once
> perf_event_exit_task() completes, PERF_RECORD_EXIT is written to the
> ring buffer and POLLHUP is set on the perf event file descriptor.
>
> In test__task_exit(), once POLLHUP is set on the fd, evlist__poll()
> returns immediately on every call without blocking. If the child is
> still in exit_mm()..exit_notify() on another CPU when the parent reads
> PERF_RECORD_EXIT, exited is still 0 and the retry loop spins through all
> 1000 non-blocking poll() calls in less than a millisecond before SIGCHLD
> is delivered.
>
> [...]

Applied to perf-tools-next, thanks!

Best regards
Namhyung