lkml.org 
[lkml]   [2015]   [Jan]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC PATCH 06/11] x86,fpu: lazily skip fpu restore with eager fpu mode, too
On 01/11, riel@redhat.com wrote:
>
> If the next task still has its FPU state present in the FPU registers,
> there is no need to restore it from memory.

Another patch I can't understand...

> --- a/arch/x86/include/asm/fpu-internal.h
> +++ b/arch/x86/include/asm/fpu-internal.h
> @@ -435,13 +435,9 @@ static inline void switch_fpu_prepare(struct task_struct *old, struct task_struc
> old->thread.fpu.last_cpu = ~0;
> if (preload) {
> new->thread.fpu_counter++;
> - if (!use_eager_fpu() && fpu_lazy_restore(new, cpu))
> - /* XXX: is this safe against ptrace??? */
> - __thread_fpu_begin(new);
> - else {
> + set_thread_flag(TIF_LOAD_FPU);
> + if (!fpu_lazy_restore(new, cpu))
> prefetch(new->thread.fpu.state);
> - set_thread_flag(TIF_LOAD_FPU);
> - }

It is not clear to me why do we set TIF_LOAD_FPU if fpu_lazy_restore()
succeeds. __thread_fpu_begin() is cheap.

At the same time, if switch_fpu_finish() does fpu_lazy_restore() anyway,
why this patch doesn't remove it from switch_fpu_prepare() ?

However,

> @@ -466,6 +462,10 @@ static inline void switch_fpu_finish(void)
>
> __thread_fpu_begin(tsk);
>
> + /* The FPU registers already have this task's FPU state. */
> + if (fpu_lazy_restore(tsk, raw_smp_processor_id()))
> + return;
> +

Now that this is called before return to user-mode, I am not sure this is
correct. Note that __kernel_fpu_begin() doesn't clear fpu_owner_task if
use_eager_fpu().

OK, interrupted_kernel_fpu_idle() should fail in this case... but as we
already discussed this means the perfomance regression, so this should
be changed.

Oleg.



\
 
 \ /
  Last update: 2015-01-14 20:01    [W:0.958 / U:0.716 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site