Re: [PATCH v4] locking/lock_events: Use this_cpu_add() when necessary

From: Peter Zijlstra
Date: Tue May 28 2019 - 04:26:27 EST

On Mon, May 27, 2019 at 12:33:56PM -0700, Linus Torvalds wrote:
> On Mon, May 27, 2019 at 1:23 AM Peter Zijlstra <peterz@xxxxxxxxxxxxx> wrote:
> >
> > That's disguisting... I see Linus already applied it, but yuck. That's
> > what we have raw_cpu_*() for.
> Ahh, I tried to look for that, but there was enough indirection and
> confusion that I wasn't sure they were generically available.
> And the "raw_cpu_*()" functions are rare enough that I'd never
> encountered them enough to really be aware of them. In fact, we seem
> to have exactly _one_ user of "raw_cpu_add()" in the whole kernel, and
> a handful of "raw_cpu_inc()".

Yeah, not having many is good. From a correctness PoV they're basically
always the wrong thing to use, except for this one usecase where we
prefer speed over correctness.

> But ack on your patch, and a heartfelt "yeah, that's the right thing". Thanks,

Thanks, I'll go write me a Changelog then ;-)