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

From: Waiman Long
Date: Fri May 24 2019 - 15:08:26 EST


On 5/24/19 3:00 PM, Linus Torvalds wrote:
> 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.

Yes, that makes sense. I will update the patch again.

Thanks,
Longman