diff options
author | Peter Zijlstra <a.p.zijlstra@chello.nl> | 2010-09-02 10:50:03 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2010-09-09 14:46:33 -0400 |
commit | 8dc85d547285668e509f86c177bcd4ea055bcaaf (patch) | |
tree | 5474dd6c31952b342f0a3f1bcec09e3049129264 /include | |
parent | eb184479874238393ac186c4e054d24311c34aaa (diff) |
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 <a.p.zijlstra@chello.nl>
Cc: paulus <paulus@samba.org>
Cc: stephane eranian <eranian@googlemail.com>
Cc: Robert Richter <robert.richter@amd.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Lin Ming <ming.m.lin@intel.com>
Cc: Yanmin <yanmin_zhang@linux.intel.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/perf_event.h | 1 | ||||
-rw-r--r-- | include/linux/sched.h | 8 |
2 files changed, 8 insertions, 1 deletions
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h index 22155ef3b362..9ecfd856ce6e 100644 --- a/include/linux/perf_event.h +++ b/include/linux/perf_event.h | |||
@@ -572,6 +572,7 @@ struct pmu { | |||
572 | 572 | ||
573 | int * __percpu pmu_disable_count; | 573 | int * __percpu pmu_disable_count; |
574 | struct perf_cpu_context * __percpu pmu_cpu_context; | 574 | struct perf_cpu_context * __percpu pmu_cpu_context; |
575 | int task_ctx_nr; | ||
575 | 576 | ||
576 | /* | 577 | /* |
577 | * Fully disable/enable this PMU, can be used to protect from the PMI | 578 | * Fully disable/enable this PMU, can be used to protect from the PMI |
diff --git a/include/linux/sched.h b/include/linux/sched.h index 1e2a6db2d7dd..89d6023c6f82 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
@@ -1160,6 +1160,12 @@ struct sched_rt_entity { | |||
1160 | 1160 | ||
1161 | struct rcu_node; | 1161 | struct rcu_node; |
1162 | 1162 | ||
1163 | enum perf_event_task_context { | ||
1164 | perf_invalid_context = -1, | ||
1165 | perf_hw_context = 0, | ||
1166 | perf_nr_task_contexts, | ||
1167 | }; | ||
1168 | |||
1163 | struct task_struct { | 1169 | struct task_struct { |
1164 | volatile long state; /* -1 unrunnable, 0 runnable, >0 stopped */ | 1170 | volatile long state; /* -1 unrunnable, 0 runnable, >0 stopped */ |
1165 | void *stack; | 1171 | void *stack; |
@@ -1431,7 +1437,7 @@ struct task_struct { | |||
1431 | struct futex_pi_state *pi_state_cache; | 1437 | struct futex_pi_state *pi_state_cache; |
1432 | #endif | 1438 | #endif |
1433 | #ifdef CONFIG_PERF_EVENTS | 1439 | #ifdef CONFIG_PERF_EVENTS |
1434 | struct perf_event_context *perf_event_ctxp; | 1440 | struct perf_event_context *perf_event_ctxp[perf_nr_task_contexts]; |
1435 | struct mutex perf_event_mutex; | 1441 | struct mutex perf_event_mutex; |
1436 | struct list_head perf_event_list; | 1442 | struct list_head perf_event_list; |
1437 | #endif | 1443 | #endif |