Re: [GIT PULL] RCU changes for v3.4
From: Paul E. McKenney
Date: Sat Mar 24 2012 - 00:49:02 EST
On Fri, Mar 23, 2012 at 09:25:04PM -0700, Linus Torvalds wrote:
> On Fri, Mar 23, 2012 at 9:17 PM, Paul E. McKenney
> <paulmck@xxxxxxxxxxxxxxxxxx> wrote:
> >
> > I must admit that __this_cpu_inc() would be nicer than __this_cpu_add(),
> > though, will fix. I need the leading "__" to avoid disabling preemption
> > needlessly on non-x86 platforms.
>
> Yeah, that's just bogus. Ok on that.
>
> > The reason that the "__raw" forms are
> > safe in this case is because the per-CPU variable is saved and restored
> > at context-switch time.
> >
> > Or am I still missing something here?
>
> It's not that the "__raw" forms are "safe". It's that they are SH*T.
>
> Don't use them. They are crap. Why would you do
>
> + __raw_get_cpu_var(rcu_read_lock_nesting) =
> + current->rcu_read_lock_nesting_save;
>
> which is just crazy and cannot use the actual sane "%fs:" segment
> overrides, but instead has to do idiotic "ready the per-cpu offset
> pointer and add it in".
>
> We've got "__this_cpu_write()" which generates the correct code.
>
> Rule of thumb: there is _never_ any good reason to use
> __raw_get_cpu_var. It's a broken interface.
OK, I will switch to __this_cpu_write(), thank you for the tip.
Thanx, Paul
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/