From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933077AbbBBTXB (ORCPT ); Mon, 2 Feb 2015 14:23:01 -0500 Received: from mx1.redhat.com ([209.132.183.28]:48603 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932701AbbBBTXA (ORCPT ); Mon, 2 Feb 2015 14:23:00 -0500 Date: Mon, 2 Feb 2015 20:21:39 +0100 From: Oleg Nesterov To: riel@redhat.com Cc: dave.hansen@linux.intel.com, sbsiddha@gmail.com, luto@amacapital.net, tglx@linutronix.de, mingo@redhat.com, hpa@zytor.com, fenghua.yu@intel.com, x86@kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 4/6] x86,fpu: use disable_task_lazy_fpu_restore helper Message-ID: <20150202192139.GA17624@redhat.com> References: <20150129210723.GA31584@redhat.com> <1422900051-10778-1-git-send-email-riel@redhat.com> <1422900051-10778-5-git-send-email-riel@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1422900051-10778-5-git-send-email-riel@redhat.com> User-Agent: Mutt/1.5.18 (2008-05-17) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org I'll try to read this patch tomorrow. Too late for me. I think it is fine, but On 02/02, riel@redhat.com 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.