You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
enable_all! / disable_all! (PR_TASK_PERF_EVENTS_DISABLE) is per-thread #59
changed the title [-]`disable_all!` (`PR_TASK_PERF_EVENTS_DISABLE`)[/-][+]`disable_all!` (`PR_TASK_PERF_EVENTS_DISABLE`) is per-thread[/+]on Apr 8, 2026
changed the title [-]`disable_all!` (`PR_TASK_PERF_EVENTS_DISABLE`) is per-thread[/-][+]`enable_all!` / `disable_all!` (`PR_TASK_PERF_EVENTS_DISABLE`) is per-thread[/+]on Apr 8, 2026
perf events are associated with the thread that create them even if they are put into another thread's context, which explains why our enable_all!() / disable_all! scale in overhead per thread event.
The C test above creates events on two separate threads, unlike LinuxPerf. So the LinuxPerf implementation is actually already correct, although clearly the prctl documentation could use some improvement.
Activity
[-]`disable_all!` (`PR_TASK_PERF_EVENTS_DISABLE`)[/-][+]`disable_all!` (`PR_TASK_PERF_EVENTS_DISABLE`) is per-thread[/+][-]`disable_all!` (`PR_TASK_PERF_EVENTS_DISABLE`) is per-thread[/-][+]`enable_all!` / `disable_all!` (`PR_TASK_PERF_EVENTS_DISABLE`) is per-thread[/+]topolarity commentedon Apr 8, 2026
Took a closer look at the kernel implementation: https://github.com/torvalds/linux/blob/3036cd0d3328220a1858b1ab390be8b562774e8a/kernel/events/core.c#L6767-L6781
perf events are associated with the thread that create them even if they are put into another thread's context, which explains why our
enable_all!()/disable_all!scale in overhead per thread event.The C test above creates events on two separate threads, unlike LinuxPerf. So the LinuxPerf implementation is actually already correct, although clearly the
prctldocumentation could use some improvement.