From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933222AbbBQIo5 (ORCPT ); Tue, 17 Feb 2015 03:44:57 -0500 Received: from mail.skyhub.de ([78.46.96.112]:59697 "EHLO mail.skyhub.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932954AbbBQIo4 (ORCPT ); Tue, 17 Feb 2015 03:44:56 -0500 Date: Tue, 17 Feb 2015 09:44:06 +0100 From: Borislav Petkov To: riel@redhat.com Cc: oleg@redhat.com, dave.hansen@linux.intel.com, sbsiddha@gmail.com, luto@amacapital.net, tglx@linutronix.de, mingo@kernel.org, hpa@zytor.com, fenghua.yu@intel.com, x86@kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 6/8] x86,fpu: use an explicit if/else in switch_fpu_prepare Message-ID: <20150217084406.GA9784@pd.tnic> References: <1423252925-14451-1-git-send-email-riel@redhat.com> <1423252925-14451-7-git-send-email-riel@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <1423252925-14451-7-git-send-email-riel@redhat.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Feb 06, 2015 at 03:02:03PM -0500, riel@redhat.com wrote: > From: Rik van Riel > > Use an explicit if/else branch after __save_init_fpu(old) in > switch_fpu_prepare. This makes substituting the assignment > with a call to task_disable_lazy_fpu() in the next patch easier > to review. > > Signed-off-by: Rik van Riel I did space-out stuff a bit ontop, it looks much more readable to me this way and that fpu.preload assignment is actually parseable at a quick glance now :-) --- From: Rik van Riel Subject: [PATCH] x86, fpu: Use an explicit if/else in switch_fpu_prepare Use an explicit if/else branch after __save_init_fpu(old) in switch_fpu_prepare. This makes substituting the assignment with a call in task_disable_lazy_fpu_restore() in the next patch easier to review. Signed-off-by: Rik van Riel Link: http://lkml.kernel.org/r/1423252925-14451-7-git-send-email-riel@redhat.com [ Boris: space out stuff for more readability. ] Signed-off-by: Borislav Petkov --- arch/x86/include/asm/fpu-internal.h | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/arch/x86/include/asm/fpu-internal.h b/arch/x86/include/asm/fpu-internal.h index 9c27f44e1c5c..04c2807aab66 100644 --- a/arch/x86/include/asm/fpu-internal.h +++ b/arch/x86/include/asm/fpu-internal.h @@ -434,13 +434,17 @@ static inline fpu_switch_t switch_fpu_prepare(struct task_struct *old, struct ta * If the task has used the math, pre-load the FPU on xsave processors * or if the past 5 consecutive context-switches used math. */ - fpu.preload = tsk_used_math(new) && (use_eager_fpu() || - new->thread.fpu_counter > 5); + fpu.preload = tsk_used_math(new) && + (use_eager_fpu() || new->thread.fpu_counter > 5); + if (__thread_has_fpu(old)) { if (!__save_init_fpu(old)) - cpu = ~0; - old->thread.fpu.last_cpu = cpu; - old->thread.fpu.has_fpu = 0; /* But leave fpu_owner_task! */ + old->thread.fpu.last_cpu = ~0; + else + old->thread.fpu.last_cpu = cpu; + + /* But leave fpu_owner_task! */ + old->thread.fpu.has_fpu = 0; /* Don't change CR0.TS if we just switch! */ if (fpu.preload) { -- 2.2.0.33.gc18b867 -- Regards/Gruss, Boris. ECO tip #101: Trim your mails when you reply. --