From: Mark Rutland <mark.rutland@arm.com>
To: Boqun Feng <boqun.feng@gmail.com>
Cc: linux-kernel@vger.kernel.org,
"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 <jiangshanlai@gmail.com>,
Colin King <colin.king@canonical.com>
Subject: Re: [RFC v2 4/5] rcu: Use for_each_leaf_node_cpu() in force_qs_rnp()
Date: Thu, 15 Dec 2016 12:04:59 +0000 [thread overview]
Message-ID: <20161215120459.GE21758@leverpostej> (raw)
In-Reply-To: <20161215024204.28620-5-boqun.feng@gmail.com>
On Thu, Dec 15, 2016 at 10:42:03AM +0800, Boqun Feng wrote:
> ->qsmask of an RCU leaf node is usually more sparse than the
> corresponding cpu_possible_mask. So replace the
> for_each_leaf_node_possible_cpu() in force_qs_rnp() with
> for_each_leaf_node_cpu() to save several checks.
>
> [Note we need to use "1UL << bit" instead of "1 << bit" to generate the
> corresponding mask for a bit because @mask is unsigned long, this was
> spotted by Colin Ian King <colin.king@canonical.com> and CoverityScan in
> a previous version of this patch.]
Nit: This note can go now that we use leaf_node_cpu_bit(). ;)
Thanks,
Mark.
> Signed-off-by: Boqun Feng <boqun.feng@gmail.com>
> ---
> kernel/rcu/tree.c | 12 +++++-------
> 1 file changed, 5 insertions(+), 7 deletions(-)
>
> diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
> index 4e5b81c843de..1ef13e63bc95 100644
> --- a/kernel/rcu/tree.c
> +++ b/kernel/rcu/tree.c
> @@ -3046,13 +3046,11 @@ static void force_qs_rnp(struct rcu_state *rsp,
> continue;
> }
> }
> - for_each_leaf_node_possible_cpu(rnp, cpu) {
> - unsigned long bit = leaf_node_cpu_bit(rnp, cpu);
> - if ((rnp->qsmask & bit) != 0) {
> - if (f(per_cpu_ptr(rsp->rda, cpu), isidle, maxj))
> - mask |= bit;
> - }
> - }
> +
> + for_each_leaf_node_cpu(rnp, rnp->qsmask, cpu)
> + if (f(per_cpu_ptr(rsp->rda, cpu), isidle, maxj))
> + mask |= leaf_node_cpu_bit(rnp, cpu);
> +
> if (mask != 0) {
> /* Idle/offline CPUs, report (releases rnp->lock. */
> rcu_report_qs_rnp(mask, rsp, rnp, rnp->gpnum, flags);
> --
> 2.10.2
>
next prev parent reply other threads:[~2016-12-15 12:07 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-15 2:41 [RFC v2 0/5] rcu: Introduce for_each_leaf_node_cpu() Boqun Feng
2016-12-15 2:42 ` [RFC v2 1/5] " Boqun Feng
2016-12-15 11:43 ` Mark Rutland
2016-12-15 14:38 ` Boqun Feng
2016-12-15 15:10 ` Mark Rutland
2016-12-15 15:14 ` Boqun Feng
2016-12-15 15:21 ` [RFC v2.1 " Boqun Feng
2016-12-15 15:29 ` Mark Rutland
2016-12-15 2:42 ` [RFC v2 2/5] rcu: Use for_each_leaf_node_cpu() in RCU stall checking Boqun Feng
2016-12-15 2:42 ` [RFC v2 3/5] rcu: Use for_each_leaf_node_cpu() in ->expmask iteration Boqun Feng
2016-12-15 2:42 ` [RFC v2 4/5] rcu: Use for_each_leaf_node_cpu() in force_qs_rnp() Boqun Feng
2016-12-15 12:04 ` Mark Rutland [this message]
2016-12-15 14:42 ` Boqun Feng
2016-12-15 14:51 ` Colin Ian King
2016-12-19 15:15 ` Boqun Feng
2016-12-20 5:09 ` Paul E. McKenney
2016-12-20 5:59 ` Boqun Feng
2016-12-20 8:11 ` Boqun Feng
2016-12-20 15:32 ` Paul E. McKenney
2016-12-20 15:23 ` Paul E. McKenney
2016-12-21 2:34 ` Boqun Feng
2016-12-21 3:40 ` Paul E. McKenney
2016-12-21 4:18 ` Boqun Feng
2016-12-21 16:48 ` Paul E. McKenney
2016-12-22 1:08 ` Boqun Feng
2016-12-15 2:42 ` [RFC v2 5/5] rcu: Use for_each_leaf_node_cpu() in online CPU iteration Boqun Feng
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=20161215120459.GE21758@leverpostej \
--to=mark.rutland@arm.com \
--cc=boqun.feng@gmail.com \
--cc=colin.king@canonical.com \
--cc=jiangshanlai@gmail.com \
--cc=josh@joshtriplett.org \
--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;
as well as URLs for NNTP newsgroup(s).