lkml.org 
[lkml]   [2015]   [Oct]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH tip/core/rcu 04/18] rcu: Use single-stage IPI algorithm for RCU expedited grace period
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 :-)


\
 
 \ /
  Last update: 2015-10-07 16:01    [W:0.197 / U:0.932 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site