[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20150513132041.GB6776@linux.vnet.ibm.com>
Date: Wed, 13 May 2015 06:20:41 -0700
From: "Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>
To: Steven Rostedt <rostedt@...dmis.org>
Cc: linux-kernel@...r.kernel.org, mingo@...nel.org,
laijs@...fujitsu.com, dipankar@...ibm.com,
akpm@...ux-foundation.org, mathieu.desnoyers@...icios.com,
josh@...htriplett.org, tglx@...utronix.de, peterz@...radead.org,
dhowells@...hat.com, edumazet@...gle.com, dvhart@...ux.intel.com,
fweisbec@...il.com, oleg@...hat.com, bobby.prani@...il.com,
Alexander Gordeev <agordeev@...hat.com>
Subject: Re: [PATCH tip/core/rcu 06/24] rcu: Cleanup rcu_init_geometry() code
and arithmetics
On Tue, May 12, 2015 at 11:22:32PM -0400, Steven Rostedt wrote:
> On Tue, 12 May 2015 15:30:36 -0700
> "Paul E. McKenney" <paulmck@...ux.vnet.ibm.com> wrote:
>
> > @@ -4103,24 +4102,21 @@ static void __init rcu_init_geometry(void)
> > return;
> > }
> >
> > + /* Calculate the number of levels in the tree. */
> > + for (i = 0; nr_cpu_ids > rcu_capacity[i]; i++) {
>
> Should this start at i = 1 as it use to? Also, should there be a safety
> check too:
>
> for (i = 1; i <= MAX_RCU_LVLS && nr_cpu_ids > rcu_capacity[i]; i++) {
Alexander, these questions are for you.
Thanx, Paul
> > + }
> > + rcu_num_lvls = i;
> > +
> > /* Calculate the number of rcu_nodes at each level of the tree. */
> > - for (i = 1; i <= MAX_RCU_LVLS; i++)
> > - if (nr_cpu_ids <= rcu_capacity[i]) {
> > - for (j = 0; j <= i; j++) {
> > - int cap = rcu_capacity[i - j];
> > - num_rcu_lvl[j] = DIV_ROUND_UP(nr_cpu_ids, cap);
> > - }
> > - rcu_num_lvls = i;
> > - for (j = i + 1; j <= MAX_RCU_LVLS; j++)
> > - num_rcu_lvl[j] = 0;
> > - break;
> > - }
> > + for (i = 0; i < rcu_num_lvls; i++) {
>
> Hmm, up above we have: for (j = 0; j <= i; j++)
>
> and now we have rcu_num_lvls = i, so shouldn't this be;
>
> for (i = 0; i <= rcu_num_lvls; i++)
>
> ?
>
> -- Steve
>
> > + int cap = rcu_capacity[rcu_num_lvls - i];
> > + num_rcu_lvl[i] = DIV_ROUND_UP(nr_cpu_ids, cap);
> > + }
> >
> > /* Calculate the total number of rcu_node structures. */
> > rcu_num_nodes = 0;
> > - for (i = 0; i <= MAX_RCU_LVLS; i++)
> > + for (i = 0; i < rcu_num_lvls; i++)
> > rcu_num_nodes += num_rcu_lvl[i];
> > - rcu_num_nodes -= nr_cpu_ids;
> > }
> >
> > void __init rcu_init(void)
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists