[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20151007154457.GL3910@linux.vnet.ibm.com>
Date: Wed, 7 Oct 2015 08:44:57 -0700
From: "Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>
To: Peter Zijlstra <peterz@...radead.org>
Cc: linux-kernel@...r.kernel.org, mingo@...nel.org,
jiangshanlai@...il.com, dipankar@...ibm.com,
akpm@...ux-foundation.org, mathieu.desnoyers@...icios.com,
josh@...htriplett.org, tglx@...utronix.de, rostedt@...dmis.org,
dhowells@...hat.com, edumazet@...gle.com, dvhart@...ux.intel.com,
fweisbec@...il.com, oleg@...hat.com, bobby.prani@...il.com
Subject: Re: [PATCH tip/core/rcu 04/18] rcu: Use single-stage IPI algorithm
for RCU expedited grace period
On Wed, Oct 07, 2015 at 03:35:45PM +0200, Peter Zijlstra wrote:
> On Tue, Oct 06, 2015 at 09:29:23AM -0700, Paul E. McKenney wrote:
>
> > +/* Flags for rcu_preempt_ctxt_queue() decision table. */
> > +#define RCU_GP_TASKS 0x8
> > +#define RCU_EXP_TASKS 0x4
> > +#define RCU_GP_BLKD 0x2
> > +#define RCU_EXP_BLKD 0x1
>
> Purely cosmetic, but that's backwards ;-) Most of our flags etc.. are in
> increasing order.
>
> > +static void rcu_preempt_ctxt_queue(struct rcu_node *rnp, struct rcu_data *rdp,
> > + unsigned long flags) __releases(rnp->lock)
> > +{
> > + int blkd_state = (rnp->gp_tasks ? RCU_GP_TASKS : 0) +
> > + (rnp->exp_tasks ? RCU_EXP_TASKS : 0) +
> > + (rnp->qsmask & rdp->grpmask ? RCU_GP_BLKD : 0) +
> > + (rnp->expmask & rdp->grpmask ? RCU_EXP_BLKD : 0);
>
> An alternative way is:
>
> int blkd_state = RCU_GP_TASKS * !!rnp->gp_tasks +
> RCU_EXP_TASKS * !!rnp->exp_tasks +
> RCU_GP_BLKD * !!(rnp->qsmask & rdp->grpmask) +
> RCU_EXP_BLKD * !!(rnp->expmask & rdp->grpmask);
>
> I suppose it depends on how your brain is wired which version reads
> easier :-)
Indeed! ;-)
I will stick with the ?: for the moment, but your multiplied bang-up
approach might well grow on me.
Thanx, Paul
--
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