diff options
author | Rusty Russell <rusty@rustcorp.com.au> | 2008-12-31 18:42:22 -0500 |
---|---|---|
committer | Rusty Russell <rusty@rustcorp.com.au> | 2008-12-31 18:42:22 -0500 |
commit | 9e01c1b74c9531e301c900edaa92a99fcb7738f2 (patch) | |
tree | f71425ecfecf32046bd6aecb5ca6e504e9258b30 /kernel/trace/trace_sysprof.c | |
parent | 333af15341b2f6cd813c054e1b441d7b6d8e9318 (diff) |
cpumask: convert kernel trace functions
Impact: Reduce future memory usage, use new cpumask API.
(Eventually, cpumask_var_t will be allocated based on nr_cpu_ids, not NR_CPUS).
Convert kernel trace functions to use struct cpumask API:
1) Use cpumask_copy/cpumask_test_cpu/for_each_cpu.
2) Use cpumask_var_t and alloc_cpumask_var/free_cpumask_var everywhere.
3) Use on_each_cpu instead of playing with current->cpus_allowed.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Mike Travis <travis@sgi.com>
Acked-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'kernel/trace/trace_sysprof.c')
-rw-r--r-- | kernel/trace/trace_sysprof.c | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/kernel/trace/trace_sysprof.c b/kernel/trace/trace_sysprof.c index a5779bd975db..eaca5ad803ff 100644 --- a/kernel/trace/trace_sysprof.c +++ b/kernel/trace/trace_sysprof.c | |||
@@ -196,9 +196,9 @@ static enum hrtimer_restart stack_trace_timer_fn(struct hrtimer *hrtimer) | |||
196 | return HRTIMER_RESTART; | 196 | return HRTIMER_RESTART; |
197 | } | 197 | } |
198 | 198 | ||
199 | static void start_stack_timer(int cpu) | 199 | static void start_stack_timer(void *unused) |
200 | { | 200 | { |
201 | struct hrtimer *hrtimer = &per_cpu(stack_trace_hrtimer, cpu); | 201 | struct hrtimer *hrtimer = &__get_cpu_var(stack_trace_hrtimer); |
202 | 202 | ||
203 | hrtimer_init(hrtimer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); | 203 | hrtimer_init(hrtimer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); |
204 | hrtimer->function = stack_trace_timer_fn; | 204 | hrtimer->function = stack_trace_timer_fn; |
@@ -208,14 +208,7 @@ static void start_stack_timer(int cpu) | |||
208 | 208 | ||
209 | static void start_stack_timers(void) | 209 | static void start_stack_timers(void) |
210 | { | 210 | { |
211 | cpumask_t saved_mask = current->cpus_allowed; | 211 | on_each_cpu(start_stack_timer, NULL, 1); |
212 | int cpu; | ||
213 | |||
214 | for_each_online_cpu(cpu) { | ||
215 | set_cpus_allowed_ptr(current, &cpumask_of_cpu(cpu)); | ||
216 | start_stack_timer(cpu); | ||
217 | } | ||
218 | set_cpus_allowed_ptr(current, &saved_mask); | ||
219 | } | 212 | } |
220 | 213 | ||
221 | static void stop_stack_timer(int cpu) | 214 | static void stop_stack_timer(int cpu) |