Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752963AbcDRNgk (ORCPT ); Mon, 18 Apr 2016 09:36:40 -0400 Received: from mail-wm0-f46.google.com ([74.125.82.46]:36683 "EHLO mail-wm0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752071AbcDRNgi (ORCPT ); Mon, 18 Apr 2016 09:36:38 -0400 Date: Mon, 18 Apr 2016 15:36:34 +0200 From: Frederic Weisbecker To: Peter Zijlstra Cc: LKML , Byungchul Park , Chris Metcalf , Thomas Gleixner , Luiz Capitulino , Christoph Lameter , "Paul E . McKenney" , Mike Galbraith , Rik van Riel , Ingo Molnar Subject: Re: [PATCH 3/3] sched: Optimize !CONFIG_NO_HZ_COMMON cpu load updates Message-ID: <20160418133633.GB29716@lerouge> References: <1460555812-25375-1-git-send-email-fweisbec@gmail.com> <1460555812-25375-4-git-send-email-fweisbec@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1460555812-25375-4-git-send-email-fweisbec@gmail.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 Content-Length: 1763 Lines: 46 On Wed, Apr 13, 2016 at 03:56:52PM +0200, Frederic Weisbecker wrote: > Some code in cpu load update only concern NO_HZ configs but it is > built on all configurations. When NO_HZ isn't built, that code is harmless > but just happens to take some useless ressources in CPU and memory: > > 1) one useless field in struct rq > 2) jiffies record on every tick that is never used (cpu_load_update_periodic) > 3) decay_load_missed is called two times on every tick to eventually > return immediately with no action taken. And that function is dead > code. > > For pure optimization purposes, lets conditionally build the NO_HZ > related code. > > Cc: Byungchul Park > Cc: Chris Metcalf > Cc: Christoph Lameter > Cc: Ingo Molnar > Cc: Luiz Capitulino > Cc: Mike Galbraith > Cc: Paul E. McKenney > Cc: Peter Zijlstra > Cc: Rik van Riel > Cc: Thomas Gleixner > Signed-off-by: Frederic Weisbecker > --- > kernel/sched/core.c | 3 ++- > kernel/sched/fair.c | 9 +++++++-- > kernel/sched/sched.h | 6 ++++-- > 3 files changed, 13 insertions(+), 5 deletions(-) > > diff --git a/kernel/sched/core.c b/kernel/sched/core.c > index 4c522a7..59a2821 100644 > --- a/kernel/sched/core.c > +++ b/kernel/sched/core.c > @@ -7327,8 +7327,9 @@ void __init sched_init(void) > > for (j = 0; j < CPU_LOAD_IDX_MAX; j++) > rq->cpu_load[j] = 0; > - > +#ifdef CONFIG_NO_HZ_COMMON > rq->last_load_update_tick = jiffies; > +#endif I forgot to also conditionally initialize it in sched_init(), I need to resend the patchset with that fixed.