From: Mark Rutland <mark.rutland@arm.com>
To: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
Cc: catalin.marinas@arm.com, dennis.chen@arm.com,
jiangshanlai@gmail.com, josh@joshtriplett.org,
linux-kernel@vger.kernel.org, mathieu.desnoyers@efficios.com,
rostedt@goodmis.org, steve.capper@arm.com, will.deacon@arm.com
Subject: Re: [PATCHv2] rcu: tree: correctly handle sparse possible CPUs
Date: Fri, 13 May 2016 02:27:01 +0100 [thread overview]
Message-ID: <20160513012701.GA7629@svinekod> (raw)
In-Reply-To: <20160517190106.GJ3528@linux.vnet.ibm.com>
On Tue, May 17, 2016 at 12:01:06PM -0700, Paul E. McKenney wrote:
> On Tue, May 17, 2016 at 11:22:10AM +0100, Mark Rutland wrote:
> > /*
> > + * Iterate over all possible CPUs in a leaf RCU node.
> > + */
> > +#define for_each_leaf_node_possible_cpu(rnp, cpu) \
> > + for ((cpu) = rnp->grplo; \
> > + cpu <= rnp->grphi; \
> > + cpu = cpumask_next((cpu), cpu_possible_mask))
>
> What if the rnp->grplo corresponds to a non-existent CPU?
Good point, I had evidently not considered that.
> Would something like this handle that possibility?
>
> +#define for_each_leaf_node_possible_cpu(rnp, cpu) \
> + for ((cpu) = cpumask_next(rnp->grplo - 1, cpu_possible_mask); \
> + cpu <= rnp->grphi; \
> + cpu = cpumask_next((cpu), cpu_possible_mask))
>
> Or maybe like this, with less duplicated code but very strange style:
>
> +#define for_each_leaf_node_possible_cpu(rnp, cpu) \
> + for ((cpu) = rnp->grplo - 1; \
> + cpu = cpumask_next((cpu), cpu_possible_mask), cpu <= rnp->grphi; 1)
>
> The first one is probably far better, assuming that it works, but I could
> not resist inflicting the second one on you. ;-)
:)
Those both look like they should work, I'll fold the former in.
> > +/*
> > + * Iterate over all possible CPUs in a leaf RCU node, at each step providing a
> > + * bit for comparison against rcu_node bitmasks.
> > + */
> > +#define for_each_leaf_node_possible_cpu_bit(rnp, cpu, bit) \
> > + for ((cpu) = rnp->grplo, (bit) = 1; \
> > + cpu <= rnp->grphi; \
> > + cpu = cpumask_next((cpu), cpu_possible_mask), \
> > + (bit) = 1UL << (cpu - rnp->grplo))
>
> Same question here.
Likewise.
I'll also see about fixing the build issue you spotted in the other reply; that
appears to be a typo (missing 'possible_' in the macro invocation).
I'm away from my development machine at the moment, so that may not appear
until next week.
Thanks,
Mark.
next prev parent reply other threads:[~2016-05-18 6:04 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-16 16:48 [PATCH] rcu: tree: correctly handle sparse possible CPUs Mark Rutland
2016-05-16 19:19 ` Paul E. McKenney
2016-05-17 10:22 ` [PATCHv2] " Mark Rutland
2016-05-17 19:01 ` Paul E. McKenney
2016-05-13 1:27 ` Mark Rutland [this message]
2016-05-18 0:12 ` Paul E. McKenney
2016-05-18 12:02 ` Arnd Bergmann
2016-05-18 18:15 ` Mark Rutland
2016-05-18 18:41 ` Paul E. McKenney
2016-05-20 10:30 ` kbuild test robot
2016-05-18 15:15 ` [PATCH] " Andrey Ryabinin
2016-05-18 18:01 ` Paul E. McKenney
2016-05-18 18:30 ` Mark Rutland
2016-05-18 18:44 ` Paul E. McKenney
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=20160513012701.GA7629@svinekod \
--to=mark.rutland@arm.com \
--cc=catalin.marinas@arm.com \
--cc=dennis.chen@arm.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 \
--cc=steve.capper@arm.com \
--cc=will.deacon@arm.com \
/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).