cpumask: convert kernel trace functions further
authorRusty Russell <rusty@rustcorp.com.au>
Wed, 31 Dec 2008 23:42:23 +0000 (10:12 +1030)
committerRusty Russell <rusty@rustcorp.com.au>
Wed, 31 Dec 2008 23:42:23 +0000 (10:12 +1030)
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>
kernel/trace/trace.c
kernel/trace/trace.h
kernel/trace/trace_boot.c
kernel/trace/trace_functions_graph.c
kernel/trace/trace_hw_branches.c
kernel/trace/trace_power.c

index 5d04e27f3b400799f9c0e2fad9ca922a3b322994..c580233add95a0915f4797b84ae05a728aa986c6 100644 (file)
@@ -1811,10 +1811,10 @@ static void test_cpu_buff_start(struct trace_iterator *iter)
        if (!(iter->iter_flags & TRACE_FILE_ANNOTATE))
                return;
 
-       if (cpu_isset(iter->cpu, iter->started))
+       if (cpumask_test_cpu(iter->cpu, iter->started))
                return;
 
-       cpu_set(iter->cpu, iter->started);
+       cpumask_set_cpu(iter->cpu, iter->started);
        trace_seq_printf(s, "##### CPU %u buffer started ####\n", iter->cpu);
 }
 
@@ -3114,10 +3114,15 @@ static int tracing_open_pipe(struct inode *inode, struct file *filp)
        if (!iter)
                return -ENOMEM;
 
+       if (!alloc_cpumask_var(&iter->started, GFP_KERNEL)) {
+               kfree(iter);
+               return -ENOMEM;
+       }
+
        mutex_lock(&trace_types_lock);
 
        /* trace pipe does not show start of buffer */
-       cpus_setall(iter->started);
+       cpumask_setall(iter->started);
 
        iter->tr = &global_trace;
        iter->trace = current_trace;
@@ -3134,6 +3139,7 @@ static int tracing_release_pipe(struct inode *inode, struct file *file)
 {
        struct trace_iterator *iter = file->private_data;
 
+       free_cpumask_var(iter->started);
        kfree(iter);
        atomic_dec(&tracing_reader);
 
index cc7a4f86403695d6934f753cbc2cc7cdc6597f80..4d3d381bfd9537e3a43df767e30fb0d2991c66d0 100644 (file)
@@ -368,7 +368,7 @@ struct trace_iterator {
        loff_t                  pos;
        long                    idx;
 
-       cpumask_t               started;
+       cpumask_var_t           started;
 };
 
 int tracing_is_enabled(void);
index 3ccebde284820ee7bbb41c8ef8b4aad9d251b47a..366c8c333e136e77d79a4579b4e70f24242b1404 100644 (file)
@@ -42,7 +42,7 @@ static int boot_trace_init(struct trace_array *tr)
        int cpu;
        boot_trace = tr;
 
-       for_each_cpu_mask(cpu, cpu_possible_map)
+       for_each_cpu(cpu, cpu_possible_mask)
                tracing_reset(tr, cpu);
 
        tracing_sched_switch_assign_trace(tr);
index 4bf39fcae97afadc384b104e5d77be0120e375e3..930c08e5b38e0d35ab93b79896b0150907d31e50 100644 (file)
@@ -79,7 +79,7 @@ print_graph_cpu(struct trace_seq *s, int cpu)
        int i;
        int ret;
        int log10_this = log10_cpu(cpu);
-       int log10_all = log10_cpu(cpus_weight_nr(cpu_online_map));
+       int log10_all = log10_cpu(cpumask_weight(cpu_online_mask));
 
 
        /*
index b6a3e20a49a9f3ef3e4851de38017d961db548da..649df22d435fc3507d05aecbb244ccf5cbcfffa1 100644 (file)
@@ -46,7 +46,7 @@ static void bts_trace_start(struct trace_array *tr)
 
        tracing_reset_online_cpus(tr);
 
-       for_each_cpu_mask(cpu, cpu_possible_map)
+       for_each_cpu(cpu, cpu_possible_mask)
                smp_call_function_single(cpu, bts_trace_start_cpu, NULL, 1);
 }
 
@@ -62,7 +62,7 @@ static void bts_trace_stop(struct trace_array *tr)
 {
        int cpu;
 
-       for_each_cpu_mask(cpu, cpu_possible_map)
+       for_each_cpu(cpu, cpu_possible_mask)
                smp_call_function_single(cpu, bts_trace_stop_cpu, NULL, 1);
 }
 
@@ -172,7 +172,7 @@ static void trace_bts_prepare(struct trace_iterator *iter)
 {
        int cpu;
 
-       for_each_cpu_mask(cpu, cpu_possible_map)
+       for_each_cpu(cpu, cpu_possible_mask)
                smp_call_function_single(cpu, trace_bts_cpu, iter->tr, 1);
 }
 
index a7172a352f626b263e4a4226d39cb732224a979c..7bda248daf5557a04ff1f178764b80777a33dff5 100644 (file)
@@ -39,7 +39,7 @@ static int power_trace_init(struct trace_array *tr)
 
        trace_power_enabled = 1;
 
-       for_each_cpu_mask(cpu, cpu_possible_map)
+       for_each_cpu(cpu, cpu_possible_mask)
                tracing_reset(tr, cpu);
        return 0;
 }