Re: [PATCH 4/6] x86,fpu: use disable_task_lazy_fpu_restore helper
From: Oleg Nesterov
Date: Mon Feb 02 2015 - 14:23:07 EST
I'll try to read this patch tomorrow. Too late for me.
I think it is fine, but
On 02/02, riel@xxxxxxxxxx wrote:
>
> This also fixes the lazy FPU restore disabling in drop_fpu, which
> only really works when !use_eager_fpu().
> ...
>
> --- a/arch/x86/include/asm/fpu-internal.h
> +++ b/arch/x86/include/asm/fpu-internal.h
> @@ -396,7 +396,7 @@ static inline void drop_fpu(struct task_struct *tsk)
> * Forget coprocessor state..
> */
> preempt_disable();
> - tsk->thread.fpu_counter = 0;
> + task_disable_lazy_fpu_restore(tsk);
> __drop_fpu(tsk);
> clear_used_math();
perhaps this makes sense anyway, but I am not sure if the changelog is right.
Note that we clear PF_USED_MATH, last_fpu/has_fpu have no effect after this.
> preempt_enable();
> @@ -440,7 +440,7 @@ static inline fpu_switch_t switch_fpu_prepare(struct task_struct *old, struct ta
> new->thread.fpu_counter > 5);
> if (__thread_has_fpu(old)) {
> if (!__save_init_fpu(old))
> - old->thread.fpu.last_cpu = ~0;
> + task_disable_lazy_fpu_restore(old);
> else
> old->thread.fpu.last_cpu = cpu;
> old->thread.fpu.has_fpu = 0; /* But leave fpu_owner_task! */
> @@ -454,7 +454,7 @@ static inline fpu_switch_t switch_fpu_prepare(struct task_struct *old, struct ta
> stts();
> } else {
> old->thread.fpu_counter = 0;
> - old->thread.fpu.last_cpu = ~0;
> + task_disable_lazy_fpu_restore(old);
I am also wondering if we can remove this task_disable_lazy_fpu_restore...
I mean, perhaps we should shift this into __thread_fpu_end() path. But this
is almost off-topic and in any case this patch should not do this.
Oleg.
--
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/