lkml.org 
[lkml]   [2009]   [Oct]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH tip/core/rcu 6/6] rcu: Simplify creating of lockdep class for root rcu_node
    Date
    From: Paul E. McKenney <paulmck@linux.vnet.ibm.com>

    Use lockdep_set_class() to simplify the code and to avoid any additional
    overhead in the !LOCKDEP case.

    Signed-off-by: Peter Zijlstra <peterz@infradead.org>
    Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
    ---
    kernel/rcutree.c | 5 ++---
    kernel/rcutree.h | 2 ++
    2 files changed, 4 insertions(+), 3 deletions(-)

    diff --git a/kernel/rcutree.c b/kernel/rcutree.c
    index ddbf111..f57c32e 100644
    --- a/kernel/rcutree.c
    +++ b/kernel/rcutree.c
    @@ -1666,8 +1666,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 +1689,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);
    }

    /*
    diff --git a/kernel/rcutree.h b/kernel/rcutree.h
    index 599161f..e091b30 100644
    --- a/kernel/rcutree.h
    +++ b/kernel/rcutree.h
    @@ -296,6 +296,8 @@ DECLARE_PER_CPU(struct rcu_data, rcu_preempt_data);

    #else /* #ifdef RCU_TREE_NONCORE */

    +static struct lock_class_key rcu_root_class;
    +
    /* Forward declarations for rcutree_plugin.h */
    static inline void rcu_bootup_announce(void);
    long rcu_batches_completed(void);
    --
    1.5.2.5


    \
     
     \ /
      Last update: 2009-10-26 03:07    [W:0.024 / U:63.684 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site