[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20090418141455.GA7082@linux.vnet.ibm.com>
Date: Sat, 18 Apr 2009 07:14:55 -0700
From: "Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>
To: Evgeniy Polyakov <zbr@...emap.net>
Cc: David Miller <davem@...emloft.net>, kaber@...sh.net,
torvalds@...ux-foundation.org, shemminger@...tta.com,
dada1@...mosbay.com, jeff.chua.linux@...il.com, paulus@...ba.org,
mingo@...e.hu, laijs@...fujitsu.com, jengelh@...ozas.de,
r000n@...0n.net, linux-kernel@...r.kernel.org,
netfilter-devel@...r.kernel.org, netdev@...r.kernel.org,
benh@...nel.crashing.org, mathieu.desnoyers@...ymtl.ca
Subject: Re: [PATCH] netfilter: use per-cpu spinlock rather than RCU (v3)
On Sat, Apr 18, 2009 at 01:40:01PM +0400, Evgeniy Polyakov wrote:
> Hi.
>
> On Thu, Apr 16, 2009 at 06:28:12PM -0700, Paul E. McKenney (paulmck@...ux.vnet.ibm.com) wrote:
> > +/* Single bit for grace-period index, low-order bits are nesting counter. */
> > +#define RCU_FGP_COUNT 1UL
> > +#define RCU_FGP_PARITY (1UL << (sizeof(long) << 2))
> > +#define RCU_FGP_NEST_MASK (RCU_FGP_PARITY - 1)
> > +
> > +extern long rcu_fgp_ctr;
> > +DECLARE_PER_CPU(long, rcu_fgp_active_readers);
> > +
> > +static inline void rcu_read_lock_fgp(void)
> > +{
> > + long tmp;
> > + long *uarp;
> > +
> > + preempt_disable();
> > + uarp = &__get_cpu_var(rcu_fgp_active_readers);
> > + tmp = *uarp;
> > + if (likely(!(tmp & RCU_FGP_NEST_MASK)))
> > + *uarp = rcu_fgp_ctr; /* Outermost rcu_read_lock(). */
> > + else
> > + *uarp = tmp + RCU_FGP_COUNT; /* Nested rcu_read_lock(). */
> > + barrier();
> > +}
> > +
> > +static inline void rcu_read_unlock_fgp(void)
> > +{
> > + barrier();
> > + __get_cpu_var(rcu_fgp_active_readers)--;
>
> Shouldn't it be rcu_fgp_active_readers - RCU_FGP_COUNT?
> Although it is 1 by definition, it is more clear when understanding
> what's going on here.
Excellent point, fixed!
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