From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
To: Pranith Kumar <bobby.prani@gmail.com>
Cc: Josh Triplett <josh@joshtriplett.org>,
Steven Rostedt <rostedt@goodmis.org>,
Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
Lai Jiangshan <laijs@cn.fujitsu.com>,
"open list:READ-COPY UPDATE..." <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2 1/2] rcu: Create a function for rcu_nocb_mask boot time setup
Date: Fri, 25 Jul 2014 08:27:29 -0700 [thread overview]
Message-ID: <20140725152729.GD11241@linux.vnet.ibm.com> (raw)
In-Reply-To: <1406248652-17416-1-git-send-email-bobby.prani@gmail.com>
On Thu, Jul 24, 2014 at 08:37:31PM -0400, Pranith Kumar wrote:
> This commit creates a function rcu_bootup_announce_oddness_nocb(), which handles
> allocation of rcu_nocb_mask and setting it according to the kernel configuration
> parameters.
>
> Signed-off-by: Pranith Kumar <bobby.prani@gmail.com>
Much better!
One more change called out below.
Thanx, Paul
> ---
> v2: don't break the print string (comment from paulmck)
>
> kernel/rcu/tree_plugin.h | 61 +++++++++++++++++++++++++++---------------------
> 1 file changed, 35 insertions(+), 26 deletions(-)
>
> diff --git a/kernel/rcu/tree_plugin.h b/kernel/rcu/tree_plugin.h
> index c31eb28..520538a 100644
> --- a/kernel/rcu/tree_plugin.h
> +++ b/kernel/rcu/tree_plugin.h
> @@ -47,6 +47,39 @@ static char __initdata nocb_buf[NR_CPUS * 5];
> #endif /* #ifdef CONFIG_RCU_NOCB_CPU */
>
> /*
> + * This is a helper for rcu_bootup_announce_oddness(), which takes care of
> + * setting up rcu_nocb_mask for nocb specific kernel configuration parameters
> + */
> +static void __init rcu_bootup_announce_oddness_nocb(void)
> +{
> +#ifndef CONFIG_RCU_NOCB_CPU_NONE
> + if (!have_rcu_nocb_mask) {
> + zalloc_cpumask_var(&rcu_nocb_mask, GFP_KERNEL);
> + have_rcu_nocb_mask = true;
> + }
> +#ifdef CONFIG_RCU_NOCB_CPU_ZERO
> + pr_info("\tOffload RCU callbacks from CPU 0\n");
> + cpumask_set_cpu(0, rcu_nocb_mask);
> +#endif /* #ifdef CONFIG_RCU_NOCB_CPU_ZERO */
> +#ifdef CONFIG_RCU_NOCB_CPU_ALL
> + pr_info("\tOffload RCU callbacks from all CPUs\n");
> + cpumask_copy(rcu_nocb_mask, cpu_possible_mask);
> +#endif /* #ifdef CONFIG_RCU_NOCB_CPU_ALL */
> +#endif /* #ifndef CONFIG_RCU_NOCB_CPU_NONE */
> + if (have_rcu_nocb_mask) {
> + if (!cpumask_subset(rcu_nocb_mask, cpu_possible_mask)) {
> + pr_info("\tNote: kernel parameter 'rcu_nocbs=' contains nonexistent CPUs.\n");
> + cpumask_and(rcu_nocb_mask, cpu_possible_mask,
> + rcu_nocb_mask);
> + }
> + cpulist_scnprintf(nocb_buf, sizeof(nocb_buf), rcu_nocb_mask);
> + pr_info("\tOffload RCU callbacks from CPUs: %s.\n", nocb_buf);
> + if (rcu_nocb_poll)
> + pr_info("\tPoll for callbacks from no-CBs CPUs.\n");
> + }
> +}
> +
> +/*
> * Check the RCU kernel configuration parameters and print informative
> * messages about anything out of the ordinary. If you like #ifdef, you
> * will love this function.
> @@ -86,32 +119,8 @@ static void __init rcu_bootup_announce_oddness(void)
> if (nr_cpu_ids != NR_CPUS)
> pr_info("\tRCU restricting CPUs from NR_CPUS=%d to nr_cpu_ids=%d.\n", NR_CPUS, nr_cpu_ids);
> #ifdef CONFIG_RCU_NOCB_CPU
Please also move the above #ifdef into rcu_bootup_announce_oddness_nocb().
The compiler will inline the resulting empty function, and it is cleaner
to have all of the NOCB-related #ifdefs in that function.
> -#ifndef CONFIG_RCU_NOCB_CPU_NONE
> - if (!have_rcu_nocb_mask) {
> - zalloc_cpumask_var(&rcu_nocb_mask, GFP_KERNEL);
> - have_rcu_nocb_mask = true;
> - }
> -#ifdef CONFIG_RCU_NOCB_CPU_ZERO
> - pr_info("\tOffload RCU callbacks from CPU 0\n");
> - cpumask_set_cpu(0, rcu_nocb_mask);
> -#endif /* #ifdef CONFIG_RCU_NOCB_CPU_ZERO */
> -#ifdef CONFIG_RCU_NOCB_CPU_ALL
> - pr_info("\tOffload RCU callbacks from all CPUs\n");
> - cpumask_copy(rcu_nocb_mask, cpu_possible_mask);
> -#endif /* #ifdef CONFIG_RCU_NOCB_CPU_ALL */
> -#endif /* #ifndef CONFIG_RCU_NOCB_CPU_NONE */
> - if (have_rcu_nocb_mask) {
> - if (!cpumask_subset(rcu_nocb_mask, cpu_possible_mask)) {
> - pr_info("\tNote: kernel parameter 'rcu_nocbs=' contains nonexistent CPUs.\n");
> - cpumask_and(rcu_nocb_mask, cpu_possible_mask,
> - rcu_nocb_mask);
> - }
> - cpulist_scnprintf(nocb_buf, sizeof(nocb_buf), rcu_nocb_mask);
> - pr_info("\tOffload RCU callbacks from CPUs: %s.\n", nocb_buf);
> - if (rcu_nocb_poll)
> - pr_info("\tPoll for callbacks from no-CBs CPUs.\n");
> - }
> -#endif /* #ifdef CONFIG_RCU_NOCB_CPU */
> + rcu_bootup_announce_oddness_nocb();
> +#endif
> }
>
> #ifdef CONFIG_TREE_PREEMPT_RCU
> --
> 2.0.1
>
prev parent reply other threads:[~2014-07-25 15:27 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-25 0:37 [PATCH v2 1/2] rcu: Create a function for rcu_nocb_mask boot time setup Pranith Kumar
2014-07-25 0:37 ` [PATCH v2 2/2] rcu: Check the return value of rcu_nocb_mask cpumask allocation Pranith Kumar
2014-07-25 15:25 ` Paul E. McKenney
2014-07-25 18:06 ` Paul E. McKenney
2014-07-25 19:33 ` Pranith Kumar
2014-07-25 15:27 ` Paul E. McKenney [this message]
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=20140725152729.GD11241@linux.vnet.ibm.com \
--to=paulmck@linux.vnet.ibm.com \
--cc=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=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