From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752004AbbIKIjj (ORCPT ); Fri, 11 Sep 2015 04:39:39 -0400 Received: from mga14.intel.com ([192.55.52.115]:55637 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751490AbbIKIjf (ORCPT ); Fri, 11 Sep 2015 04:39:35 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.17,511,1437462000"; d="scan'208";a="802956829" Date: Fri, 11 Sep 2015 08:50:01 +0800 From: Yuyang Du To: Morten Rasmussen Cc: Vincent Guittot , Benjamin Segall , Peter Zijlstra , Dietmar Eggemann , Steve Muckle , "mingo@redhat.com" , "daniel.lezcano@linaro.org" , "mturquette@baylibre.com" , "rjw@rjwysocki.net" , Juri Lelli , "sgurrappadi@nvidia.com" , "pang.xunlei@zte.com.cn" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH 5/6] sched/fair: Get rid of scaling utilization by capacity_orig Message-ID: <20150911005001.GB3014@intel.com> References: <55EDDD5A.70904@arm.com> <20150908122606.GH3644@twins.programming.kicks-ass.net> <20150908125205.GW18673@twins.programming.kicks-ass.net> <20150908143157.GA27098@e105550-lin.cambridge.arm.com> <20150908153300.GK3644@twins.programming.kicks-ass.net> <20150910110638.GE27098@e105550-lin.cambridge.arm.com> <20150910121018.GF27098@e105550-lin.cambridge.arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150910121018.GF27098@e105550-lin.cambridge.arm.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Sep 10, 2015 at 01:10:19PM +0100, Morten Rasmussen wrote: > > > so it appear to be intended to be using low resolution like load_avg > > > (weight is scaled down before it is passed into __update_load_avg()), > > > but util_avg is shifted up to high resolution. It should be: > > > > > > sa->util_avg = (sa->util_sum << (SCHED_LOAD_SHIFT - > > > SCHED_LOAD_SHIFT)) / LOAD_AVG_MAX; > > > > you probably mean (SCHED_LOAD_SHIFT - SCHED_LOAD_RESOLUTION) > > Yes. Thanks for providing the right expression. There seems to be enough > confusion in this thread already :) And yes, it is my bad in the first place, sorry, I did not think it though :) > > The goal of this patchset is to be able to scale util_avg in the range > > of cpu capacity so why don't we directly initialize it with > > sa->util_avg = SCHED_CAPACITY_SCALE; Yes, we should, and specifically, it is bacause we can combine the resolution thing for util% * capacity%, so we only need to use the resolution once. > > and then use > > > > sa->util_avg = (sa->util_sum << SCHED_CAPACITY_SHIFT) / LOAD_AVG_MAX; > > > > so we don't have to take care of high and low load resolution > > That works for me, except that the left-shift has gone be PeterZ's > optimization patch posted earlier in this thread. It is changing > util_sum to scaled by capacity instead of being the pure geometric > series which requires the left shift at the end when we divide by > LOAD_AVG_MAX. So it should be equivalent to what you are proposing if we > change the initialization to your proposal too. I previously initialized the util_sum as: sa->util_sum = LOAD_AVG_MAX; it is because wihout capacity adjustment, this can save some multiplications in __update_load_avg(), but actually if we do capacity adjustment, we must multiply anyway, so it is better we initialize it as: sa->util_sum = sa->util_avg * LOAD_AVG_MAX; Anyway, with the patch I posted in the other email in this thread, we can fix all this very clearly, I hope so. I did not post a fix patch, it is because the solutions are already there, it is just how we make it look better, and you can provide it in your new version. Thanks, Yuyang