rcu: Simplify creating of lockdep class for root rcu_node
authorPeter Zijlstra <peterz@infradead.org>
Mon, 26 Oct 2009 17:24:31 +0000 (10:24 -0700)
committerIngo Molnar <mingo@elte.hu>
Mon, 26 Oct 2009 20:07:16 +0000 (21:07 +0100)
Use lockdep_set_class() to simplify the code and to avoid any
additional overhead in the !LOCKDEP case.  Also move the
definition of rcu_root_class into kernel/rcutree.c, as suggested
by Lai Jiangshan.

Signed-off-by: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Cc: laijs@cn.fujitsu.com
Cc: dipankar@in.ibm.com
Cc: mathieu.desnoyers@polymtl.ca
Cc: josh@joshtriplett.org
Cc: dvhltc@us.ibm.com
Cc: niv@us.ibm.com
Cc: rostedt@goodmis.org
Cc: Valdis.Kletnieks@vt.edu
Cc: dhowells@redhat.com
LKML-Reference: <1256577871443-git-send-email->
Signed-off-by: Ingo Molnar <mingo@elte.hu>
kernel/rcutree.c

index ddbf111e9e18e8e31cf25d88238e5d8aac03aa8b..055f1a941a9e01a238b1831520936c1f0479ec10 100644 (file)
@@ -51,6 +51,8 @@
 
 /* Data structures. */
 
+static struct lock_class_key rcu_root_class;
+
 #define RCU_STATE_INITIALIZER(name) { \
        .level = { &name.node[0] }, \
        .levelcnt = { \
@@ -1666,8 +1668,7 @@ static void __init rcu_init_one(struct rcu_state *rsp)
                cpustride *= rsp->levelspread[i];
                rnp = rsp->level[i];
                for (j = 0; j < rsp->levelcnt[i]; j++, rnp++) {
-                       if (rnp != rcu_get_root(rsp))
-                               spin_lock_init(&rnp->lock);
+                       spin_lock_init(&rnp->lock);
                        rnp->gpnum = 0;
                        rnp->qsmask = 0;
                        rnp->qsmaskinit = 0;
@@ -1690,7 +1691,7 @@ static void __init rcu_init_one(struct rcu_state *rsp)
                        INIT_LIST_HEAD(&rnp->blocked_tasks[1]);
                }
        }
-       spin_lock_init(&rcu_get_root(rsp)->lock);
+       lockdep_set_class(&rcu_get_root(rsp)->lock, &rcu_root_class);
 }
 
 /*