From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753849AbbJTJtA (ORCPT ); Tue, 20 Oct 2015 05:49:00 -0400 Received: from bombadil.infradead.org ([198.137.202.9]:37116 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751540AbbJTJs7 (ORCPT ); Tue, 20 Oct 2015 05:48:59 -0400 Date: Tue, 20 Oct 2015 11:48:48 +0200 From: Peter Zijlstra To: Byungchul Park Cc: mingo@kernel.org, linux-kernel@vger.kernel.org, fweisbec@gmail.com, tglx@linutronix.de Subject: Re: [PATCH v4 1/2] sched: make __update_cpu_load() handle active tickless case Message-ID: <20151020094848.GZ17308@twins.programming.kicks-ass.net> References: <1444816056-11886-1-git-send-email-byungchul.park@lge.com> <1444816056-11886-2-git-send-email-byungchul.park@lge.com> <20151019131618.GU17308@twins.programming.kicks-ass.net> <20151020004932.GB28741@byungchulpark-X58A-UD3R> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20151020004932.GB28741@byungchulpark-X58A-UD3R> User-Agent: Mutt/1.5.21 (2012-12-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Oct 20, 2015 at 09:49:32AM +0900, Byungchul Park wrote: > > > = A^i * cpu_load(n-i) + (A^(i-1) + A^(i-2) + ... + 1) * B > > > , where i = pending_updates - 1 > > > > You missed an opportunity here, if you take i==n you avoid the need for > > i entirely. > > i don't think so. as i said, _n_ is the current tick -1 and _i_ is > pending_updates - 1. we cannot take i == n, but should keep (n-i). Just think relative; it doesn't matter when in time we do this. So 0 to n is identical to any other interval. > > > = A^i * cpu_load(n-i) + B * (A^i - 1) / (A - 1) > > > , by geometric series formula for sum > > > > That's wrong; the limited geometric series expands to: > > NO, that's not wrong. it doesn't matter at all. > > a * (1 - r^n) / (1 - r) > = a * (-1)(r^n - 1) / (-1)(r - 1) > = a * (r^n - 1) / (r - 1) > > i mean these two are exactly same. Ah indeed! Sorry for that. I clearly didn't think beyond the series expansion I found. > > I've rewritten the things a little; does this look good to you? > > however, your expressions and descriptions below look better than me, > except some logical errors. could you keep my logical flow unchagned? > > + * load[i]_n = (1 - 1/2^i) * load[i]_n-1 + (1/2^i) * load_n-1 > > + * = A * load[i]_n-1 + B ; A := (1 - 1/2^i), B := (1/2^i) * load > > + * = A * (A * load[i]_n-2 + B) + B > > + * = A * (A * (A * load[i]_n-3 + B) + B) + B > > + * = A^3 * load[i]_n-3 + (A^2 + A + 1) * B > > + * = A^n * load[i]_0 + (A^(n-1) + A^(n-2) + ... + 1) * B > > + * = A^n * load[i]_0 + ((1 - A^n) / (1 - A)) * B > > + * = (1 - 1/2^i)^n * (load[i]_0 - load) + load That is the same logic, right? Please be more specific as to what you'd like restored.