use get_cpu_call_rcu_data() for get_call_rcu_data()
authorLai Jiangshan <laijs@cn.fujitsu.com>
Thu, 15 Sep 2011 15:10:31 +0000 (11:10 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Thu, 15 Sep 2011 15:10:31 +0000 (11:10 -0400)
[ Impact: refactor duplicated code ]

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

index e0a8fd883ee4a24782b3464a970f20be645b5fdc..1fbce98e27cda467c9419e297275f01ad8e535fa 100644 (file)
@@ -435,22 +435,17 @@ struct call_rcu_data *get_default_call_rcu_data(void)
  */
 struct call_rcu_data *get_call_rcu_data(void)
 {
-       int curcpu;
-       static int warned = 0;
+       struct call_rcu_data *crd;
 
        if (thread_call_rcu_data != NULL)
                return thread_call_rcu_data;
-       if (maxcpus <= 0)
-               return get_default_call_rcu_data();
-       curcpu = sched_getcpu();
-       if (!warned && (curcpu < 0 || maxcpus <= curcpu)) {
-               fprintf(stderr, "[error] liburcu: gcrd CPU # out of range\n");
-               warned = 1;
+
+       if (maxcpus > 0) {
+               crd = get_cpu_call_rcu_data(sched_getcpu());
+               if (crd)
+                       return crd;
        }
-       if (curcpu >= 0 && maxcpus > curcpu &&
-           per_cpu_call_rcu_data != NULL &&
-           per_cpu_call_rcu_data[curcpu] != NULL)
-               return per_cpu_call_rcu_data[curcpu];
+
        return get_default_call_rcu_data();
 }
 
This page took 0.026833 seconds and 4 git commands to generate.