| Date | Tue, 13 Jan 2015 16:24:30 +0100 | From | Oleg Nesterov <> | Subject | Re: [RFC PATCH 03/11] x86,fpu: move __thread_fpu_begin to when the task has the fpu |
| |
On 01/11, riel@redhat.com wrote: > > --- a/arch/x86/include/asm/fpu-internal.h > +++ b/arch/x86/include/asm/fpu-internal.h > @@ -420,7 +420,6 @@ static inline void switch_fpu_prepare(struct task_struct *old, struct task_struc > if (preload) { > new->thread.fpu_counter++; > set_thread_flag(TIF_LOAD_FPU); > - __thread_set_has_fpu(new); > prefetch(new->thread.fpu.state); > } else if (!use_eager_fpu()) > stts(); > @@ -436,7 +435,6 @@ static inline void switch_fpu_prepare(struct task_struct *old, struct task_struc > prefetch(new->thread.fpu.state); > set_thread_flag(TIF_LOAD_FPU); > } > - __thread_fpu_begin(new); > } > /* else: CR0.TS is still set from a previous FPU switch */ > } > @@ -451,6 +449,7 @@ static inline void switch_fpu_prepare(struct task_struct *old, struct task_struc > static inline void switch_fpu_finish(struct task_struct *new) > { > if (test_and_clear_thread_flag(TIF_LOAD_FPU)) { > + __thread_fpu_begin(new); > if (unlikely(restore_fpu_checking(new))) > drop_init_fpu(new); > }
Then perhaps it makes sense to move fpu_lazy_restore() to fpu_finish() too ?
Either way, afaics we do not need use_eager_fpu() before fpu_lazy_restore(), and this reminds me that every use_eager_fpu() check in switch_fpu_prepare() looks confusing.
Oleg.
|