From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753319AbdAZPKE (ORCPT ); Thu, 26 Jan 2017 10:10:04 -0500 Received: from mail-wj0-f195.google.com ([209.85.210.195]:32971 "EHLO mail-wj0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752650AbdAZPKA (ORCPT ); Thu, 26 Jan 2017 10:10:00 -0500 Date: Thu, 26 Jan 2017 16:09:55 +0100 From: Ingo Molnar To: Rik van Riel Cc: linux-kernel@vger.kernel.org, Andrew Morton , Andy Lutomirski , Borislav Petkov , Dave Hansen , Fenghua Yu , "H . Peter Anvin" , Linus Torvalds , Oleg Nesterov , Peter Zijlstra , Thomas Gleixner , Yu-cheng Yu Subject: Re: [PATCH 1/7] x86/fpu: Simplify the fpu->last_cpu logic and rename it to fpu->fpregs_cached Message-ID: <20170126150955.GA12274@gmail.com> References: <1485429989-23340-1-git-send-email-mingo@kernel.org> <1485429989-23340-2-git-send-email-mingo@kernel.org> <1485442458.15964.50.camel@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1485442458.15964.50.camel@redhat.com> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org * Rik van Riel wrote: > On Thu, 2017-01-26 at 12:26 +0100, Ingo Molnar wrote: > > > index c56fb57f2991..7eb2f3041fde 100644 > > --- a/kernel/sched/core.c > > +++ b/kernel/sched/core.c > > @@ -1253,6 +1253,8 @@ void set_task_cpu(struct task_struct *p, > > unsigned int new_cpu) > >   p->sched_class->migrate_task_rq(p); > >   p->se.nr_migrations++; > >   perf_event_task_migrate(p); > > + > > + arch_task_migrate(p); > >   } > > > > Does it really count as a "simplification" if you add a > scheduler callback? > > This code does not seem any easier to understand than > the old code... See the extra commit I added on top: 7deff4369276 x86/fpu: Unify the naming of the FPU register cache validity flags which makes it clearer, we now have: ->fpregs_owner [bool] fpregs_owner_ctx [ptr] That are set to 1 and the context pointer when a task with no FPU state is scheduled in and where the state of the previous task is preserved (cached) in the FPU registers - and which FPU register state cache can be invalidated after this by clearing any of the two flags. That should make its overall meaning clearer, in that they represent a single 'cache' where the cache validity flag is split into two copies, where any of which can be used to invalidate the cache. Thanks, Ingo