From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754808AbbJGPpM (ORCPT ); Wed, 7 Oct 2015 11:45:12 -0400 Received: from e39.co.us.ibm.com ([32.97.110.160]:47005 "EHLO e39.co.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753954AbbJGPpI (ORCPT ); Wed, 7 Oct 2015 11:45:08 -0400 X-IBM-Helo: d03dlp03.boulder.ibm.com X-IBM-MailFrom: paulmck@linux.vnet.ibm.com X-IBM-RcptTo: linux-kernel@vger.kernel.org Date: Wed, 7 Oct 2015 08:44:57 -0700 From: "Paul E. McKenney" To: Peter Zijlstra Cc: linux-kernel@vger.kernel.org, mingo@kernel.org, jiangshanlai@gmail.com, dipankar@in.ibm.com, akpm@linux-foundation.org, mathieu.desnoyers@efficios.com, josh@joshtriplett.org, tglx@linutronix.de, rostedt@goodmis.org, dhowells@redhat.com, edumazet@google.com, dvhart@linux.intel.com, fweisbec@gmail.com, oleg@redhat.com, bobby.prani@gmail.com Subject: Re: [PATCH tip/core/rcu 04/18] rcu: Use single-stage IPI algorithm for RCU expedited grace period Message-ID: <20151007154457.GL3910@linux.vnet.ibm.com> Reply-To: paulmck@linux.vnet.ibm.com References: <20151006162907.GA12020@linux.vnet.ibm.com> <1444148977-14108-1-git-send-email-paulmck@linux.vnet.ibm.com> <1444148977-14108-4-git-send-email-paulmck@linux.vnet.ibm.com> <20151007133545.GB3604@twins.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20151007133545.GB3604@twins.programming.kicks-ass.net> User-Agent: Mutt/1.5.21 (2010-09-15) X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 15100715-0033-0000-0000-0000064563E6 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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