Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932627AbdCaHOD (ORCPT ); Fri, 31 Mar 2017 03:14:03 -0400 Received: from merlin.infradead.org ([205.233.59.134]:41896 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932271AbdCaHOC (ORCPT ); Fri, 31 Mar 2017 03:14:02 -0400 Date: Fri, 31 Mar 2017 09:13:52 +0200 From: Peter Zijlstra To: Yuyang Du Cc: Paul Turner , Ingo Molnar , LKML , Benjamin Segall , Morten Rasmussen , Vincent Guittot , Dietmar Eggemann , Matt Fleming , umgwanakikbuti@gmail.com Subject: Re: [RESEND PATCH 2/2] sched/fair: Optimize __update_sched_avg() Message-ID: <20170331071352.sukbf6su5ng22oyc@hirez.programming.kicks-ass.net> References: <1486935863-25251-1-git-send-email-yuyang.du@intel.com> <1486935863-25251-3-git-send-email-yuyang.du@intel.com> <20170328144625.GX3093@worktop> <20170329000442.GC2459@ydu19desktop> <20170329104126.lg6ismevfbqywpcj@hirez.programming.kicks-ass.net> <20170330121658.6mo7datma4ssw7st@hirez.programming.kicks-ass.net> <20170330141428.deiduft5btwid6ov@hirez.programming.kicks-ass.net> <20170330191355.GD16440@ydu19desktop> <20170330194118.GE16440@ydu19desktop> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170330194118.GE16440@ydu19desktop> User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 939 Lines: 31 On Fri, Mar 31, 2017 at 03:41:18AM +0800, Yuyang Du wrote: > > > > > > p > > > c2 = 1024 \Sum y^n > > > n=1 > > > > > > inf inf > > > = 1024 ( \Sum y^n - \Sum y^n - y^0 ) > > > n=0 n=p > > > > It looks surprisingly kinda works :) > > > > > + c2 = LOAD_AVG_MAX - decay_load(LOAD_AVG_MAX, periods) - 1024; > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > But, I'm not sure this is what you want (just assume p==0). > > > > Oh, what I meant is when p != 0, actually p>=1. Right, note that we'll never get here with p==0. For p==1 we'll have c2==0, and for p > 1 we'll have whatever section we wanted. > And thinking about it for a while, it's really what you want, brilliant :) Right, because: inf inf inf ( \Sum y^n ) y^p = \Sum y^(n+p) = \Sum y^n n=0 n=0 n=p