rcu: Simplify creating of lockdep class for root rcu_node
PATCH 1/1 rcu: Simplify creating of lockdep class for root rcu_node
From: Peter Zijlstra <[email protected]>
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 <[email protected]>
Signed-off-by Paul E. McKenney <[email protected]>
--- kernel/rcutree.c | 7 ++++--- 1 files changed, 4 insertions(+), 3 deletions(-)
kernel/rcutree.c +4 -3
@@ -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); }/*
Signature · 1 line
1.5.2.5
Commit-ID: 88b91c7ca49bc8600cf1106eb891d08c1965b9ce Gitweb: http://git.kernel.org/tip/88b91c7ca49bc8600cf1106eb891d08c1965b9ce Author: Peter Zijlstra <[email protected]> AuthorDate: Mon, 26 Oct 2009 10:24:31 -0700 Committer: Ingo Molnar <[email protected]> CommitDate: Mon, 26 Oct 2009 21:07:16 +0100
rcu: Simplify creating of lockdep class for root rcu_node
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 <[email protected]>
Signed-off-by Paul E. McKenney <[email protected]>
LKML-Reference: <1256577871443-git-send-email->
Signed-off-by Ingo Molnar <[email protected]>
--- kernel/rcutree.c | 7 ++++--- 1 files changed, 4 insertions(+), 3 deletions(-)
kernel/rcutree.c +4 -3
@@ -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); }/*