perf: Support only inheriting events if cloned with CLONE_THREAD
authorMarco Elver <elver@google.com>
Thu, 8 Apr 2021 10:35:58 +0000 (12:35 +0200)
committerPeter Zijlstra <peterz@infradead.org>
Fri, 16 Apr 2021 14:32:40 +0000 (16:32 +0200)
commit2b26f0aa004995f49f7b6f4100dd0e4c39a9ed5f
tree27077a92806b93fffb58a3eaf0fad81cbf2e42c9
parent47f661eca0700928012e11c57ea0328f5ccfc3b9
perf: Support only inheriting events if cloned with CLONE_THREAD

Adds bit perf_event_attr::inherit_thread, to restricting inheriting
events only if the child was cloned with CLONE_THREAD.

This option supports the case where an event is supposed to be
process-wide only (including subthreads), but should not propagate
beyond the current process's shared environment.

Suggested-by: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Marco Elver <elver@google.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lore.kernel.org/lkml/YBvj6eJR%2FDY2TsEB@hirez.programming.kicks-ass.net/
include/linux/perf_event.h
include/uapi/linux/perf_event.h
kernel/events/core.c
kernel/fork.c