lkml.org 
[lkml]   [2019]   [May]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH] locking/lock_events: Use this_cpu_add() when necessary
From
Date
On 5/22/19 3:54 PM, Linus Torvalds wrote:
> On Wed, May 22, 2019 at 8:40 AM Waiman Long <longman@redhat.com> wrote:
>> +#if defined(CONFIG_PREEMPT) && \
>> + (defined(CONFIG_DEBUG_PREEMPT) || !defined(CONFIG_X86))
>> +#define lockevent_percpu_inc(x) this_cpu_inc(x)
>> +#define lockevent_percpu_add(x, v) this_cpu_add(x, v)
> Why that CONFIG_X86 special case?
>
> On x86, the regular non-underscore versionm is perfectly fine, and the
> underscore is no faster or simpler.

The condition is to use non-underscore version only when

1) It is a preempt kernel; AND
2) It either have CONFIG_DEBUG_PREEMPT on, OR it is a non-x86 system.


> So just make it be
>
> #if defined(CONFIG_PREEMPT)
> .. non-underscore versions..
> #else
> .. underscore versions ..
> #endif
>
> and realize that x86 simply doesn't _care_. On x86, it will be one
> single instruction regardless.
>
> Non-x86 may prefer the underscore versions for the non-preempt case.

I was thinking of doing that originally, but then change it so x86
preempt kernel will also use the underscore version as long as
CONFIG_DEBUG_PREEMPT is not set.

I can change it back if that makes it less confusing.

Cheers,
Longman

\
 
 \ /
  Last update: 2019-05-22 22:51    [W:0.050 / U:0.276 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site