Re: [PATCH RFC tip/core/rcu 15/18] rcu: give different levels ofthe rcu_node hierarchy distinct lockdep names

From: Peter Zijlstra
Date: Wed Dec 16 2009 - 05:33:49 EST


On Wed, 2009-12-16 at 11:26 +0100, Peter Zijlstra wrote:
> On Tue, 2009-12-15 at 15:02 -0800, Paul E. McKenney wrote:
> > From: Paul E. McKenney <paulmck@xxxxxxxxxxxxxxxxxx>
> >
> > Proposed for 2.6.34, not for inclusion.
> >
> > Previously, each level of the rcu_node hierarchy had the same rather
> > unimaginative name: "&rcu_node_class[i]". This makes lockdep diagnostics
> > involving these lockdep classes less helpful than would be nice. This
> > patch fixes this by giving each level of the rcu_node hierarchy a distinct
> > name: "rcu_node_level_0", "rcu_node_level_1", and so on.
> >
> > Signed-off-by: Paul E. McKenney <paulmck@xxxxxxxxxxxxxxxxxx>
> > ---
> > kernel/rcutree.c | 9 ++++++++-
> > 1 files changed, 8 insertions(+), 1 deletions(-)
> >
> > diff --git a/kernel/rcutree.c b/kernel/rcutree.c
> > index 0a4c328..a6e45f6 100644
> > --- a/kernel/rcutree.c
> > +++ b/kernel/rcutree.c
> > @@ -1811,11 +1811,17 @@ static void __init rcu_init_levelspread(struct rcu_state *rsp)
> > */
> > static void __init rcu_init_one(struct rcu_state *rsp)
> > {
> > + static char *buf[] = { "rcu_node_level_0",
> > + "rcu_node_level_1",
> > + "rcu_node_level_2",
> > + "rcu_node_level_3" }; /* Match MAX_RCU_LVLS */
> > int cpustride = 1;
> > int i;
> > int j;
> > struct rcu_node *rnp;
> >
> > + WARN_ON_ONCE(MAX_RCU_LVLS > 4); /* Fix buf[] initialization! */

An even better option:

BUILD_BUG_ON(MAX_RCU_LVLS > array_size(buf));

That way it'll fail to even build when these two get out of whack.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/