Re: [PATCH 10/11] x86: Remove unnecessary ifdefs from i387 code.

From: Brian Gerst
Date: Mon Aug 30 2010 - 07:21:50 EST


On Mon, Aug 30, 2010 at 1:44 AM, Pekka Enberg <penberg@xxxxxxxxxx> wrote:
> ÂHi Brian,
>
> On 8/30/10 2:38 AM, Brian Gerst wrote:
>>
>> On Sun, Aug 29, 2010 at 3:00 PM, Pekka Enberg<penberg@xxxxxxxxxx> Âwrote:
>>>
>>> On Sat, Aug 28, 2010 at 7:04 PM, Brian Gerst<brgerst@xxxxxxxxx> Âwrote:
>>>>
>>>> Remove ifdefs for code that the compiler can optimize away on 64-bit.
>>>>
>>>> Signed-off-by: Brian Gerst<brgerst@xxxxxxxxx>
>>>> @@ -74,10 +74,8 @@ static void __cpuinit init_thread_xstate(void)
>>>>
>>>> Â Â Â Âif (cpu_has_fxsr)
>>>> Â Â Â Â Â Â Â Âxstate_size = sizeof(struct i387_fxsave_struct);
>>>> -#ifdef CONFIG_X86_32
>>>> Â Â Â Âelse
>>>> Â Â Â Â Â Â Â Âxstate_size = sizeof(struct i387_fsave_struct);
>>>> -#endif
>>>> Â}
>>>
>>> I guess this is OK but keep in mind that cpu_has_fsxr is _not_
>>> optimized by the compiler on 64-bit so the change probably increases
>>> kernel text by few bytes.
>>
>> FXSR is a required feature on 64-bit, therefore cpu_has_fxsr is always
>> true.
>
> Yes, I realize that but it will still read boot_cpu_data at runtime, no?

Look at cpu_has(). It checks REQUIRED_MASK* if the feature bit is a
constant, and returns true without testing the actual bit in
boot_cpu_data for required features.

--
Brian Gerst
--
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/