From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932964AbbBBS43 (ORCPT ); Mon, 2 Feb 2015 13:56:29 -0500 Received: from mx1.redhat.com ([209.132.183.28]:43485 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932133AbbBBS41 (ORCPT ); Mon, 2 Feb 2015 13:56:27 -0500 Date: Mon, 2 Feb 2015 19:55:01 +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 5/6] x86,fpu: also check fpu_lazy_restore when use_eager_fpu Message-ID: <20150202185501.GB16547@redhat.com> References: <20150129210723.GA31584@redhat.com> <1422900051-10778-1-git-send-email-riel@redhat.com> <1422900051-10778-6-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-6-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 On 02/02, riel@redhat.com wrote: > > From: Rik van Riel > > With Oleg's patch "x86, fpu: don't abuse FPU in kernel threads if > use_eager_fpu()", kernel threads no longer have an FPU state even > on systems with use_eager_fpu() > > That in turn means that a task may still have its FPU state > loaded in the FPU registers, if the task only got interrupted by > kernel threads from when it went to sleep, to when it woke up > again. > > In that case, there is no need to restore the FPU state for > this task, since it is still in the registers. > > The kernel can simply use the same logic to determine this as > is used for !use_eager_fpu() systems. Yes, agreed, I was going to do this too. And in fact this change make sense even without "don't abuse FPU in kernel threads", I think. But in theory it depends on another change, "__kernel_fpu_begin() should clear fpu_owner_task even if use_eager_fpu()". And that series was ignored ;) I think this patch is fine. > --- a/arch/x86/include/asm/fpu-internal.h > +++ b/arch/x86/include/asm/fpu-internal.h > @@ -457,7 +457,7 @@ static inline fpu_switch_t switch_fpu_prepare(struct task_struct *old, struct ta > task_disable_lazy_fpu_restore(old); > if (fpu.preload) { > new->thread.fpu_counter++; > - if (!use_eager_fpu() && fpu_lazy_restore(new, cpu)) > + if (fpu_lazy_restore(new, cpu)) > fpu.preload = 0; > else > prefetch(new->thread.fpu.state); > -- > 1.9.3 >