mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Pranith Kumar <bobby.prani@gmail.com>
To: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>,
	Josh Triplett <josh@joshtriplett.org>,
	Steven Rostedt <rostedt@goodmis.org>,
	Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
	Lai Jiangshan <laijs@cn.fujitsu.com>,
	linux-kernel@vger.kernel.org (open list:READ-COPY UPDATE...)
Subject: [PATCH 3/3] rcu: Use rcu_num_nodes instead of NUM_RCU_NODES
Date: Tue, 15 Jul 2014 18:31:49 -0400	[thread overview]
Message-ID: <1405463509-2468-3-git-send-email-bobby.prani@gmail.com> (raw)
In-Reply-To: <1405463509-2468-1-git-send-email-bobby.prani@gmail.com>

NUM_RCU_NODES is set at build time and is usually a huge number. We calculate the
actual number of rcu nodes necessary at boot time based on nr_cpu_ids in
rcu_init_geometry() and store it in rcu_num_nodes. We should use this variable
instead of NUM_RCU_NODES.

This commit changes all such uses of NUM_RCU_NODES to rcu_num_nodes.

Signed-off-by: Pranith Kumar <bobby.prani@gmail.com>
---
 kernel/rcu/tree_plugin.h | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/kernel/rcu/tree_plugin.h b/kernel/rcu/tree_plugin.h
index cedb020..17ccb62 100644
--- a/kernel/rcu/tree_plugin.h
+++ b/kernel/rcu/tree_plugin.h
@@ -46,6 +46,8 @@ static bool __read_mostly rcu_nocb_poll;    /* Offload kthread are to poll. */
 static char __initdata nocb_buf[NR_CPUS * 5];
 #endif /* #ifdef CONFIG_RCU_NOCB_CPU */
 
+extern int rcu_num_nodes;
+
 /*
  * Check the RCU kernel configuration parameters and print informative
  * messages about anything out of the ordinary.  If you like #ifdef, you
@@ -885,7 +887,7 @@ void synchronize_rcu_expedited(void)
 	/* Snapshot current state of ->blkd_tasks lists. */
 	rcu_for_each_leaf_node(rsp, rnp)
 		sync_rcu_preempt_exp_init(rsp, rnp);
-	if (NUM_RCU_NODES > 1)
+	if (rcu_num_nodes > 1)
 		sync_rcu_preempt_exp_init(rsp, rcu_get_root(rsp));
 
 	put_online_cpus();
@@ -1475,7 +1477,7 @@ static void __init rcu_spawn_boost_kthreads(void)
 	BUG_ON(smpboot_register_percpu_thread(&rcu_cpu_thread_spec));
 	rnp = rcu_get_root(rcu_state_p);
 	(void)rcu_spawn_one_boost_kthread(rcu_state_p, rnp);
-	if (NUM_RCU_NODES > 1) {
+	if (rcu_num_nodes > 1) {
 		rcu_for_each_leaf_node(rcu_state_p, rnp)
 			(void)rcu_spawn_one_boost_kthread(rcu_state_p, rnp);
 	}
-- 
1.9.1


  parent reply	other threads:[~2014-07-15 22:31 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-15 22:31 [PATCH 1/3] rcu: tiny.c: Update reference to tree.c Pranith Kumar
2014-07-15 22:31 ` [PATCH 2/3] rcu: Remove stale comment in tree.c Pranith Kumar
2014-07-15 22:53   ` josh
2014-07-15 22:57     ` Pranith Kumar
2014-07-16 12:47       ` Paul E. McKenney
2014-07-16 13:29         ` Pranith Kumar
2014-07-16 23:32           ` josh
2014-07-17  0:55           ` Lai Jiangshan
2014-07-17  1:01             ` Pranith Kumar
2014-07-17  1:25               ` Lai Jiangshan
2014-07-17  1:26                 ` Pranith Kumar
2014-07-17  2:14               ` Josh Triplett
2014-07-17  2:20                 ` Pranith Kumar
2014-07-17 23:33                   ` Paul E. McKenney
2014-07-15 22:31 ` Pranith Kumar [this message]
2014-07-15 22:54   ` [PATCH 3/3] rcu: Use rcu_num_nodes instead of NUM_RCU_NODES josh
2014-07-16 12:45   ` Paul E. McKenney
2014-07-16 13:26     ` Pranith Kumar
2014-07-15 22:52 ` [PATCH 1/3] rcu: tiny.c: Update reference to tree.c josh

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1405463509-2468-3-git-send-email-bobby.prani@gmail.com \
    --to=bobby.prani@gmail.com \
    --cc=josh@joshtriplett.org \
    --cc=laijs@cn.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=paulmck@linux.vnet.ibm.com \
    --cc=rostedt@goodmis.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome