init maxcpus before use
authorLai Jiangshan <laijs@cn.fujitsu.com>
Thu, 15 Sep 2011 15:01:38 +0000 (11:01 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Thu, 15 Sep 2011 15:01:38 +0000 (11:01 -0400)
[ Edit:
  Covers the per-cpu call_rcu data setup (not all_cpus helper, which is
  why we did not trigger it in our tests. ]

Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
urcu-call-rcu-impl.h

index 700d1289192a31a5f2693cf79e4efd99be993220..e0a8fd883ee4a24782b3464a970f20be645b5fdc 100644 (file)
@@ -386,6 +386,7 @@ int set_cpu_call_rcu_data(int cpu, struct call_rcu_data *crdp)
        static int warned = 0;
 
        call_rcu_lock(&call_rcu_mutex);
+       alloc_cpu_call_rcu_data();
        if (cpu < 0 || maxcpus <= cpu) {
                if (!warned) {
                        fprintf(stderr, "[error] liburcu: set CPU # out of range\n");
@@ -395,7 +396,6 @@ int set_cpu_call_rcu_data(int cpu, struct call_rcu_data *crdp)
                errno = EINVAL;
                return -EINVAL;
        }
-       alloc_cpu_call_rcu_data();
        call_rcu_unlock(&call_rcu_mutex);
        if (per_cpu_call_rcu_data == NULL) {
                errno = ENOMEM;
This page took 0.025794 seconds and 4 git commands to generate.