Re: [PATCH tip:x86/mm 1/3] x86: A fast way to check capabilitiesof the current cpu
From: H. Peter Anvin
Date: Wed Mar 30 2011 - 12:19:15 EST
On 03/30/2011 08:58 AM, H. Peter Anvin wrote:
> On 03/14/2011 12:49 PM, Andi Kleen wrote:
>> Tejun Heo <tj@xxxxxxxxxx> writes:
>>
>>> Add this_cpu_has() which determines if the current cpu has a certain
>>> ability using a segment prefix and a bit test operation.
>>
>>
>> Hmm: if the CPU capability is really tested in a performance critical
>> path, wouldn't it even be better to just use static_branch() now?
>>
>
> We have static_cpu_has() for this specific purpose (it actually predates
> static_branch()).
>
Note that static_cpu_has() has two caveats:
1. Before alternatives patching, it will always be false.
2. It is the equivalent of boot_cpu_has(), i.e. the intersection of all
the CPU feature sets (available at boot time, obviously.)
-hpa
--
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/