Re: [PATCH 0/3] x86, fpu: more eagerfpu cleanups

Oleg Nesterov
2015-02-20T13:32:19Z

On 02/20, Borislav Petkov wrote:
>
> On Mon, Jan 19, 2015 at 07:51:09PM +0100, Oleg Nesterov wrote:
> > math_state_restore() and its usage doesn't look nice. init_fpu() too,
>
> Yeah, about that:
>
> I see:
>
> math_state_restore
> ...
> if (!tsk_used_math(tsk))
> init_fpu()
>
> and init_fpu() then does:
>
> if (tsk_used_math(tsk))
>

Yes, and more. math_state_restore() assumes that it is called with irqs
disabled. At least if !tsk_used_math. That is why 3/3 calls init_fpu()
first. Not only this doesn't look clean, this is simply not true in
general.

The comment above init_fpu() is simply wrong. And unlazy_fpu() from
there doesn't look nice. This mixes 2 completely differents things.

> Could use a cleanup and so on... Perhaps it is in the works already :)

Yes, I'll try to make the cleanups on top of these changes. And let me
repeat that there is another reason for 1/3 and 2/3 at least (3/3 makes
sense too), if we add TIF_LOAD_FPU we need to avoid the performance
regression (irq_fpu_usable() should not fail if !__thread_has_fpu()).

Oleg.