From patchwork Mon Sep 7 18:54:18 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dietmar Eggemann X-Patchwork-Id: 53248 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f72.google.com (mail-la0-f72.google.com [209.85.215.72]) by patches.linaro.org (Postfix) with ESMTPS id CD3C322B05 for ; Mon, 7 Sep 2015 18:54:34 +0000 (UTC) Received: by lanb10 with SMTP id b10sf29472621lan.3 for ; Mon, 07 Sep 2015 11:54:32 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:subject:to:references:cc:from :message-id:date:user-agent:mime-version:in-reply-to:content-type :content-transfer-encoding:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=Tm+846oHtQxSKVTg0sHxg3xlq12iGzP2s9ychrrYuUs=; b=B1z2ax8TXj2/EyaRgot7SmvvCF9X1xtADuf7GozV/D1xTMeZQ3yiq7HZnPusd//h1u sU/KHcCgL+Gkac45DQqPlkevwPVT75CTG7Rvmb+iLrP9nbFSGpH5gHcSGr8ySnoRwi2y Thyn4462ekUVNQh2H0KES92BCnIC3EV4B7ARuEmuIQgc6YYMvME8PGTQ5DeWoq/r/u2T jj9qjXFNngMMHqE+7R84UG6tlTVocMzHcmQkFll3acpWjVoe9MHWI5Kiqq7VAz6LCyJe hVOWHvUzxPT9/1EhjFSSssvn78NOZm4mfNLwSaN/ukBpZtTq5ZxAKKngwvpQ/Ahas+58 N7DA== X-Gm-Message-State: ALoCoQlBghRwbJBIfXAKQD56yE32i35SpQ2747PB7zzm6VrFziZtxYbUXGeoV6NdCOpOskApd/sp X-Received: by 10.195.12.83 with SMTP id eo19mr5379441wjd.0.1441652072038; Mon, 07 Sep 2015 11:54:32 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.29.170 with SMTP id l10ls626491lah.82.gmail; Mon, 07 Sep 2015 11:54:31 -0700 (PDT) X-Received: by 10.112.136.201 with SMTP id qc9mr18304119lbb.94.1441652071802; Mon, 07 Sep 2015 11:54:31 -0700 (PDT) Received: from mail-lb0-f169.google.com (mail-lb0-f169.google.com. [209.85.217.169]) by mx.google.com with ESMTPS id k3si793296lbv.139.2015.09.07.11.54.31 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 07 Sep 2015 11:54:31 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.169 as permitted sender) client-ip=209.85.217.169; Received: by lbcjc2 with SMTP id jc2so42663387lbc.0 for ; Mon, 07 Sep 2015 11:54:31 -0700 (PDT) X-Received: by 10.152.198.140 with SMTP id jc12mr18348628lac.19.1441652071664; Mon, 07 Sep 2015 11:54:31 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.59.35 with SMTP id w3csp530342lbq; Mon, 7 Sep 2015 11:54:30 -0700 (PDT) X-Received: by 10.68.197.231 with SMTP id ix7mr49003476pbc.85.1441652070410; Mon, 07 Sep 2015 11:54:30 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id rm13si1177277pab.133.2015.09.07.11.54.29; Mon, 07 Sep 2015 11:54:30 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751981AbbIGSy0 (ORCPT + 28 others); Mon, 7 Sep 2015 14:54:26 -0400 Received: from eu-smtp-delivery-143.mimecast.com ([146.101.78.143]:22757 "EHLO eu-smtp-delivery-143.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750839AbbIGSyX convert rfc822-to-8bit (ORCPT ); Mon, 7 Sep 2015 14:54:23 -0400 Received: from cam-owa1.Emea.Arm.com (fw-tnat.cambridge.arm.com [217.140.96.140]) by eu-smtp-1.mimecast.com with ESMTP id uk-mta-5-aDacKajdRR2K4UucCdMtyQ-1; Mon, 07 Sep 2015 19:54:19 +0100 Received: from [10.2.131.51] ([10.1.2.79]) by cam-owa1.Emea.Arm.com with Microsoft SMTPSVC(6.0.3790.3959); Mon, 7 Sep 2015 19:54:19 +0100 Subject: Re: [PATCH 5/6] sched/fair: Get rid of scaling utilization by capacity_orig To: Vincent Guittot References: <1439569394-11974-1-git-send-email-morten.rasmussen@arm.com> <1439569394-11974-6-git-send-email-morten.rasmussen@arm.com> <55E8DD00.2030706@linaro.org> <55EDAF43.30500@arm.com> Cc: Steve Muckle , Morten Rasmussen , "peterz@infradead.org" , "mingo@redhat.com" , "daniel.lezcano@linaro.org" , "yuyang.du@intel.com" , "mturquette@baylibre.com" , "rjw@rjwysocki.net" , Juri Lelli , "sgurrappadi@nvidia.com" , "pang.xunlei@zte.com.cn" , "linux-kernel@vger.kernel.org" From: Dietmar Eggemann Message-ID: <55EDDD5A.70904@arm.com> Date: Mon, 7 Sep 2015 19:54:18 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 MIME-Version: 1.0 In-Reply-To: X-OriginalArrivalTime: 07 Sep 2015 18:54:19.0615 (UTC) FILETIME=[9A4656F0:01D0E99E] X-MC-Unique: aDacKajdRR2K4UucCdMtyQ-1 Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: dietmar.eggemann@arm.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.169 as permitted sender) smtp.mailfrom=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , On 07/09/15 17:21, Vincent Guittot wrote: > On 7 September 2015 at 17:37, Dietmar Eggemann wrote: >> On 04/09/15 00:51, Steve Muckle wrote: >>> Hi Morten, Dietmar, >>> >>> On 08/14/2015 09:23 AM, Morten Rasmussen wrote: >>> ... >>>> + * cfs_rq.avg.util_avg is the sum of running time of runnable tasks plus the >>>> + * recent utilization of currently non-runnable tasks on a CPU. It represents >>>> + * the amount of utilization of a CPU in the range [0..capacity_orig] where >>> >>> I see util_sum is scaled by SCHED_LOAD_SHIFT at the end of >>> __update_load_avg(). If there is now an assumption that util_avg may be >>> used directly as a capacity value, should it be changed to >>> SCHED_CAPACITY_SHIFT? These are equal right now, not sure if they will >>> always be or if they can be combined. >> >> You're referring to the code line >> >> 2647 sa->util_avg = (sa->util_sum << SCHED_LOAD_SHIFT) / LOAD_AVG_MAX; >> >> in __update_load_avg()? >> >> Here we actually scale by 'SCHED_LOAD_SCALE/LOAD_AVG_MAX' so both values are >> load related. > > I agree with Steve that there is an issue from a unit point of view > > sa->util_sum and LOAD_AVG_MAX have the same unit so sa->util_avg is a > load because of << SCHED_LOAD_SHIFT) > > Before this patch , the translation from load to capacity unit was > done in get_cpu_usage with "* capacity) >> SCHED_LOAD_SHIFT" > > So you still have to change the unit from load to capacity with a "/ > SCHED_LOAD_SCALE * SCHED_CAPACITY_SCALE" somewhere. > > sa->util_avg = ((sa->util_sum << SCHED_LOAD_SHIFT) /SCHED_LOAD_SCALE * > SCHED_CAPACITY_SCALE / LOAD_AVG_MAX = (sa->util_sum << > SCHED_CAPACITY_SHIFT) / LOAD_AVG_MAX; I see the point but IMHO this will only be necessary if the SCHED_LOAD_RESOLUTION stuff gets re-enabled again. It's not really about utilization or capacity units but rather about using the same SCALE/SHIFT values for both sides, right? I always thought that scale_load_down() takes care of that. So shouldn't: fix that issue in case SCHED_LOAD_RESOLUTION != 0 ? I would vote for removing this SCHED_LOAD_RESOLUTION thing completely so that we can assume that load/util and capacity are always using 1024/10. Cheers, -- Dietmar > > > Regards, > Vincent > > >> >> LOAD (UTIL) and CAPACITY have the same SCALE and SHIFT values because >> SCHED_LOAD_RESOLUTION is always defined to 0. scale_load() and >> scale_load_down() are also NOPs so this area is probably >> worth a separate clean-up. >> Beyond that, I'm not sure if the current functionality is >> broken if we use different SCALE and SHIFT values for LOAD and CAPACITY? >> [...] --- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/ diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 3445d2fb38f4..b80f799aface 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -2644,7 +2644,7 @@ __update_load_avg(u64 now, int cpu, struct sched_avg *sa, cfs_rq->runnable_load_avg = div_u64(cfs_rq->runnable_load_sum, LOAD_AVG_MAX); } - sa->util_avg = (sa->util_sum << SCHED_LOAD_SHIFT) / LOAD_AVG_MAX; + sa->util_avg = (sa->util_sum * scale_load_down(SCHED_LOAD_SCALE)) / LOAD_AVG_MAX; } return decayed;