Re: [PATCH] avoid second smp_processor_id() call in__touch_watchdog

From: Frederic Weisbecker
Date: Wed Sep 22 2010 - 12:47:13 EST


On Wed, Sep 22, 2010 at 06:39:19PM +0200, Peter Zijlstra wrote:
> On Wed, 2010-09-22 at 18:27 +0200, Frederic Weisbecker wrote:
> >
> > I'm not sure we want this. This is called by the watchdog internally,
> > from the timer or the cpu bound thread, so we probably should better
> > keep __get_cpu_var() because it checks that we are not in a preemptable
> > section.
>
> The smp_processor_id() right at the start already does that.
>
> That said, I doubt it really matter one way or the other, compilers have
> been known to do CSE for quite a while.


I don't mind personally. We indeed have this smp_processor_id() that
does the check already. But that's also for readability: reviewers
that are used to deal with per cpu datas are also used to see
per_cpu() for remote percpu data access and get_cpu_var() for local
percpu.

Plus some archs may override their __my_cpu_offset implementation
to provide a faster access.

--
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/