Question on perf event context swap at process switch

From: Ravi Bangoria
Date: Fri Jul 22 2022 - 10:47:37 EST


Hi Peter,

Consider two processes having clone contexts (for example, two children of
the same parent). While process switch between these two, the perf event
context would get swapped but event->hw.target will point to other sibling's
task_struct. If that process exit just after one context swap, _free_event()
will call put_task_context() on sibling process' task_struct. Wouldn't it
result into fatal error later?

Thanks,
Ravi