perf: Multiple task contexts
Subsystems (2)
Commit-ID: 8dc85d547285668e509f86c177bcd4ea055bcaaf Gitweb: http://git.kernel.org/tip/8dc85d547285668e509f86c177bcd4ea055bcaaf Author: Peter Zijlstra <[email protected]> AuthorDate: Thu, 2 Sep 2010 16:50:03 +0200 Committer: Ingo Molnar <[email protected]> CommitDate: Thu, 9 Sep 2010 20:46:33 +0200
perf: Multiple task contexts
Provide the infrastructure for multiple task contexts.
A more flexible approach would have resulted in more pointer chases in the scheduling hot-paths. This approach has the limitation of a static number of task contexts.
Since I expect most external PMUs to be system wide, or at least node wide (as per the intel uncore unit) they won't actually need a task context.
Signed-off-by Peter Zijlstra <[email protected]>
Cc paulus <[email protected]>
Cc stephane eranian <[email protected]>
Cc Robert Richter <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Cc Lin Ming <[email protected]>
Cc Yanmin <[email protected]>
LKML-Reference: <new-submission>
Signed-off-by Ingo Molnar <[email protected]>
--- include/linux/perf_event.h | 1 + include/linux/sched.h | 8 +- kernel/perf_event.c | 336 ++++++++++++++++++++++++++++++-------------- 3 files changed, 239 insertions(+), 106 deletions(-)
include/linux/perf_event.h +1 -0
@@ -572,6 +572,7 @@ struct pmu {int *__percpu pmu_disable_count;struct perf_cpu_context *__percpu pmu_cpu_context; +int task_ctx_nr;/* * Fully disable/enable this PMU, can be used to protect from the PMI
include/linux/sched.h +7 -1
@@ -1160,6 +1160,12 @@ struct sched_rt_entity {struct rcu_node ; +enum perf_event_task_context { + perf_invalid_context =-1 , + perf_hw_context =0 , + perf_nr_task_contexts, +}; +struct task_struct {volatile long state;/* -1 unrunnable, 0 runnable, >0 stopped */ void *stack;
@@ -1431,7 +1437,7 @@ struct task_struct {struct futex_pi_state *pi_state_cache;#endif #ifdef CONFIG_PERF_EVENTS -struct perf_event_context *perf_event_ctxp; +struct perf_event_context *perf_event_ctxp[perf_nr_task_contexts];struct mutex perf_event_mutex;struct list_head perf_event_list;#endif
kernel/perf_event.c +231 -105
658 lines not on this page · raw message