diff options
author | Rusty Russell <rusty@rustcorp.com.au> | 2008-12-31 18:42:23 -0500 |
---|---|---|
committer | Rusty Russell <rusty@rustcorp.com.au> | 2008-12-31 18:42:23 -0500 |
commit | 4462344ee9ea9224d026801b877887f2f39774a3 (patch) | |
tree | deb703d6858f2fb7f7db69c65e90560ce4a0654e /kernel/trace | |
parent | 9e01c1b74c9531e301c900edaa92a99fcb7738f2 (diff) |
cpumask: convert kernel trace functions further
Impact: Reduce future memory usage, use new cpumask API.
Since the last patch was created and acked, more old cpumask users
slipped into kernel/trace.
Mostly trivial conversions, except struct trace_iterator's "started"
member becomes a cpumask_var_t.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'kernel/trace')
-rw-r--r-- | kernel/trace/trace.c | 12 | ||||
-rw-r--r-- | kernel/trace/trace.h | 2 | ||||
-rw-r--r-- | kernel/trace/trace_boot.c | 2 | ||||
-rw-r--r-- | kernel/trace/trace_functions_graph.c | 2 | ||||
-rw-r--r-- | kernel/trace/trace_hw_branches.c | 6 | ||||
-rw-r--r-- | kernel/trace/trace_power.c | 2 |
6 files changed, 16 insertions, 10 deletions
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index 5d04e27f3b40..c580233add95 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c | |||
@@ -1811,10 +1811,10 @@ static void test_cpu_buff_start(struct trace_iterator *iter) | |||
1811 | if (!(iter->iter_flags & TRACE_FILE_ANNOTATE)) | 1811 | if (!(iter->iter_flags & TRACE_FILE_ANNOTATE)) |
1812 | return; | 1812 | return; |
1813 | 1813 | ||
1814 | if (cpu_isset(iter->cpu, iter->started)) | 1814 | if (cpumask_test_cpu(iter->cpu, iter->started)) |
1815 | return; | 1815 | return; |
1816 | 1816 | ||
1817 | cpu_set(iter->cpu, iter->started); | 1817 | cpumask_set_cpu(iter->cpu, iter->started); |
1818 | trace_seq_printf(s, "##### CPU %u buffer started ####\n", iter->cpu); | 1818 | trace_seq_printf(s, "##### CPU %u buffer started ####\n", iter->cpu); |
1819 | } | 1819 | } |
1820 | 1820 | ||
@@ -3114,10 +3114,15 @@ static int tracing_open_pipe(struct inode *inode, struct file *filp) | |||
3114 | if (!iter) | 3114 | if (!iter) |
3115 | return -ENOMEM; | 3115 | return -ENOMEM; |
3116 | 3116 | ||
3117 | if (!alloc_cpumask_var(&iter->started, GFP_KERNEL)) { | ||
3118 | kfree(iter); | ||
3119 | return -ENOMEM; | ||
3120 | } | ||
3121 | |||
3117 | mutex_lock(&trace_types_lock); | 3122 | mutex_lock(&trace_types_lock); |
3118 | 3123 | ||
3119 | /* trace pipe does not show start of buffer */ | 3124 | /* trace pipe does not show start of buffer */ |
3120 | cpus_setall(iter->started); | 3125 | cpumask_setall(iter->started); |
3121 | 3126 | ||
3122 | iter->tr = &global_trace; | 3127 | iter->tr = &global_trace; |
3123 | iter->trace = current_trace; | 3128 | iter->trace = current_trace; |
@@ -3134,6 +3139,7 @@ static int tracing_release_pipe(struct inode *inode, struct file *file) | |||
3134 | { | 3139 | { |
3135 | struct trace_iterator *iter = file->private_data; | 3140 | struct trace_iterator *iter = file->private_data; |
3136 | 3141 | ||
3142 | free_cpumask_var(iter->started); | ||
3137 | kfree(iter); | 3143 | kfree(iter); |
3138 | atomic_dec(&tracing_reader); | 3144 | atomic_dec(&tracing_reader); |
3139 | 3145 | ||
diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h index cc7a4f864036..4d3d381bfd95 100644 --- a/kernel/trace/trace.h +++ b/kernel/trace/trace.h | |||
@@ -368,7 +368,7 @@ struct trace_iterator { | |||
368 | loff_t pos; | 368 | loff_t pos; |
369 | long idx; | 369 | long idx; |
370 | 370 | ||
371 | cpumask_t started; | 371 | cpumask_var_t started; |
372 | }; | 372 | }; |
373 | 373 | ||
374 | int tracing_is_enabled(void); | 374 | int tracing_is_enabled(void); |
diff --git a/kernel/trace/trace_boot.c b/kernel/trace/trace_boot.c index 3ccebde28482..366c8c333e13 100644 --- a/kernel/trace/trace_boot.c +++ b/kernel/trace/trace_boot.c | |||
@@ -42,7 +42,7 @@ static int boot_trace_init(struct trace_array *tr) | |||
42 | int cpu; | 42 | int cpu; |
43 | boot_trace = tr; | 43 | boot_trace = tr; |
44 | 44 | ||
45 | for_each_cpu_mask(cpu, cpu_possible_map) | 45 | for_each_cpu(cpu, cpu_possible_mask) |
46 | tracing_reset(tr, cpu); | 46 | tracing_reset(tr, cpu); |
47 | 47 | ||
48 | tracing_sched_switch_assign_trace(tr); | 48 | tracing_sched_switch_assign_trace(tr); |
diff --git a/kernel/trace/trace_functions_graph.c b/kernel/trace/trace_functions_graph.c index 4bf39fcae97a..930c08e5b38e 100644 --- a/kernel/trace/trace_functions_graph.c +++ b/kernel/trace/trace_functions_graph.c | |||
@@ -79,7 +79,7 @@ print_graph_cpu(struct trace_seq *s, int cpu) | |||
79 | int i; | 79 | int i; |
80 | int ret; | 80 | int ret; |
81 | int log10_this = log10_cpu(cpu); | 81 | int log10_this = log10_cpu(cpu); |
82 | int log10_all = log10_cpu(cpus_weight_nr(cpu_online_map)); | 82 | int log10_all = log10_cpu(cpumask_weight(cpu_online_mask)); |
83 | 83 | ||
84 | 84 | ||
85 | /* | 85 | /* |
diff --git a/kernel/trace/trace_hw_branches.c b/kernel/trace/trace_hw_branches.c index b6a3e20a49a9..649df22d435f 100644 --- a/kernel/trace/trace_hw_branches.c +++ b/kernel/trace/trace_hw_branches.c | |||
@@ -46,7 +46,7 @@ static void bts_trace_start(struct trace_array *tr) | |||
46 | 46 | ||
47 | tracing_reset_online_cpus(tr); | 47 | tracing_reset_online_cpus(tr); |
48 | 48 | ||
49 | for_each_cpu_mask(cpu, cpu_possible_map) | 49 | for_each_cpu(cpu, cpu_possible_mask) |
50 | smp_call_function_single(cpu, bts_trace_start_cpu, NULL, 1); | 50 | smp_call_function_single(cpu, bts_trace_start_cpu, NULL, 1); |
51 | } | 51 | } |
52 | 52 | ||
@@ -62,7 +62,7 @@ static void bts_trace_stop(struct trace_array *tr) | |||
62 | { | 62 | { |
63 | int cpu; | 63 | int cpu; |
64 | 64 | ||
65 | for_each_cpu_mask(cpu, cpu_possible_map) | 65 | for_each_cpu(cpu, cpu_possible_mask) |
66 | smp_call_function_single(cpu, bts_trace_stop_cpu, NULL, 1); | 66 | smp_call_function_single(cpu, bts_trace_stop_cpu, NULL, 1); |
67 | } | 67 | } |
68 | 68 | ||
@@ -172,7 +172,7 @@ static void trace_bts_prepare(struct trace_iterator *iter) | |||
172 | { | 172 | { |
173 | int cpu; | 173 | int cpu; |
174 | 174 | ||
175 | for_each_cpu_mask(cpu, cpu_possible_map) | 175 | for_each_cpu(cpu, cpu_possible_mask) |
176 | smp_call_function_single(cpu, trace_bts_cpu, iter->tr, 1); | 176 | smp_call_function_single(cpu, trace_bts_cpu, iter->tr, 1); |
177 | } | 177 | } |
178 | 178 | ||
diff --git a/kernel/trace/trace_power.c b/kernel/trace/trace_power.c index a7172a352f62..7bda248daf55 100644 --- a/kernel/trace/trace_power.c +++ b/kernel/trace/trace_power.c | |||
@@ -39,7 +39,7 @@ static int power_trace_init(struct trace_array *tr) | |||
39 | 39 | ||
40 | trace_power_enabled = 1; | 40 | trace_power_enabled = 1; |
41 | 41 | ||
42 | for_each_cpu_mask(cpu, cpu_possible_map) | 42 | for_each_cpu(cpu, cpu_possible_mask) |
43 | tracing_reset(tr, cpu); | 43 | tracing_reset(tr, cpu); |
44 | return 0; | 44 | return 0; |
45 | } | 45 | } |