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

From: Linus Torvalds
Date: Fri May 24 2019 - 15:04:22 EST


On Fri, May 24, 2019 at 11:54 AM Waiman Long <longman@xxxxxxxxxx> wrote:
>
> v2: Simplify the condition to just preempt or !preempt.
> v3: Document the imprecise nature of the percpu count.

My point was that if they are imprecise., then you shouldn't use CONFIG_PREEMPT.

Because CONFIG_PREEMPT doesn't matter, and the count is imprecise with
it or without it.

So if they are imprecise, then what matters isn't whether the
operation is atomic or not, and the real issue is avout whether it
causes that "BUG: using __this_cpu_add() in preemptible" message.

IOW, you should use the config option that matters and is relevant,
namely CONFIG_DEBUG_PREEMPT.

Linus