Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp319788imu; Mon, 5 Nov 2018 01:11:29 -0800 (PST) X-Google-Smtp-Source: AJdET5ce90DX9MIyn0gFn8LpSq7J0ITFmG5IJon87Zcd63tZIBDM7VJKp21ajO5Np+04ktR+4u3f X-Received: by 2002:a62:7982:: with SMTP id u124-v6mr20728579pfc.95.1541409089054; Mon, 05 Nov 2018 01:11:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541409089; cv=none; d=google.com; s=arc-20160816; b=lQ0+qurgoDnVzDrHDQxJMYApp40iQDtmQqmrno/wbGgnHERSQ580au2LlfvxIlbjxS NVElrRHHYhiOolF+2+PTi9TLCNDPXcSua4OGF42fr5Q2RnegTzbZzrRiNdfSsBhOyoUd 7GiSrzGWwj2PIUO1AGhT1I+llg9bLNHH2xrpAuFPvKo0S5/Zyh7P4hWOtsG0/snhXJ7D D4MOc6hWob3fwG+E/tH98nUeX1Steks6eN9TuITR98226C88AqAUxbU22XRuw083w0uf /TmrWPrNzOjRF7e+XytPkM7cqoU9DJfuqkznqvSmthqbZUrr3RbxMIiANrD7nqXeil0m d/CQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=7lOqJouOVsIdClifOwBjLiSRytE2GZe9OIrdEAvf0xg=; b=rbYjddEhVnYVgz/AmDld+MUySH3tZMTCxn4GSSW7Ej3reJwq6DAc9itf5UfnRAeSBi I1/3AqEUumL5+ObugCQexeP8k6MzqHYHm46NdELL8Q1euaJlRvA0ozHpfdgMHl80mpDI UPXciK9c44U16j1RvKHM5J3JIowa7QUC1/Vr+AcuLDn3v3Ra6PLYmwtjo7hv6KNwy/pC /0+NwFeTm5PAS7XiqcqrfHObJ/GwEE3Xy0mf32nQyALFL//kPNCoua2QWPGI2cXKQ9Np hr9TfSjLC7hft6vCD9FvF+Lb+mBHzA1nwCsGhXjCyCsH/YnXA5FsiDFQN/h+VZiFclbP jtIQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="SlThV/EA"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n78-v6si32590238pfi.171.2018.11.05.01.11.13; Mon, 05 Nov 2018 01:11:29 -0800 (PST) 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; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="SlThV/EA"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727040AbeKES3a (ORCPT + 99 others); Mon, 5 Nov 2018 13:29:30 -0500 Received: from mail-io1-f68.google.com ([209.85.166.68]:37127 "EHLO mail-io1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726125AbeKES33 (ORCPT ); Mon, 5 Nov 2018 13:29:29 -0500 Received: by mail-io1-f68.google.com with SMTP id k17-v6so5945086ioc.4 for ; Mon, 05 Nov 2018 01:10:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=7lOqJouOVsIdClifOwBjLiSRytE2GZe9OIrdEAvf0xg=; b=SlThV/EAqQNE2JKMccaki+XzjJ93FRA9a0UdQsOQM/VloHnUTzo4oyXQW2bhuAyoye ElMKj5DJP0Glws6BAUSdWV0aggHyE6wM88e99puEX+hFjkfg/pQz67lsV+du4Aur1G6+ O3OSdJDtwIR24mo/gj0XN7EydwvYLDNxIewqE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=7lOqJouOVsIdClifOwBjLiSRytE2GZe9OIrdEAvf0xg=; b=iAVBKYoZ2hthjyunNVS1RgurdgsREQx4kXD2wPcG/1TWw7iUSpSPUlBUO+cuFFD7SJ 3mXB4ncAdT8ry2Je3rZNz5gv46zy/2VsW92iUMl7smIBT0bEjsojwJ/R0oAatDOyUB4U 66Nzbt2afbiUoh1Dy53W02WPc81R7azKJyJKnxKjTj37fjIEnLCRiLMAbsQavLH3avLj +Hs7OiIYP5rgCVuAbV+x5aSjJZsF99gprj6/XIwelBrlyto+pVQZOKjrdfVZEJHDBUDX 10KnNpfnVDMu9lqX5w/D+yNFzBipuNOWV7ptn1vw4ipTXjwNAtog18wxpK87EPE5qFph 3i8w== X-Gm-Message-State: AGRZ1gIRBT7OsuNDAADuns5umCIo0kHelIzuopQqX/uf4bOthwKBjJAt /nSXNaML8bCnQpH9zVaunuAiszX/hR6VGlqVQkO1FA== X-Received: by 2002:a6b:244:: with SMTP id 65-v6mr16451451ioc.183.1541409046410; Mon, 05 Nov 2018 01:10:46 -0800 (PST) MIME-Version: 1.0 References: <1540570303-6097-1-git-send-email-vincent.guittot@linaro.org> <1540570303-6097-3-git-send-email-vincent.guittot@linaro.org> In-Reply-To: From: Vincent Guittot Date: Mon, 5 Nov 2018 10:10:34 +0100 Message-ID: Subject: Re: [PATCH v5 2/2] sched/fair: update scale invariance of PELT To: Dietmar Eggemann Cc: Peter Zijlstra , Ingo Molnar , linux-kernel , "Rafael J. Wysocki" , Morten Rasmussen , Patrick Bellasi , Paul Turner , Ben Segall , Thara Gopinath , pkondeti@codeaurora.org Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 2 Nov 2018 at 16:36, Dietmar Eggemann wrote: > > On 10/26/18 6:11 PM, Vincent Guittot wrote: > > The current implementation of load tracking invariance scales the > > contribution with current frequency and uarch performance (only for > > utilization) of the CPU. One main result of this formula is that the > > figures are capped by current capacity of CPU. Another one is that the > > load_avg is not invariant because not scaled with uarch. > > > > The util_avg of a periodic task that runs r time slots every p time slots > > varies in the range : > > > > U * (1-y^r)/(1-y^p) * y^i < Utilization < U * (1-y^r)/(1-y^p) > > > > with U is the max util_avg value = SCHED_CAPACITY_SCALE > > > > At a lower capacity, the range becomes: > > > > U * C * (1-y^r')/(1-y^p) * y^i' < Utilization < U * C * (1-y^r')/(1-y^p) > > > > with C reflecting the compute capacity ratio between current capacity and > > max capacity. > > > > so C tries to compensate changes in (1-y^r') but it can't be accurate. > > > > Instead of scaling the contribution value of PELT algo, we should scale the > > running time. The PELT signal aims to track the amount of computation of > > tasks and/or rq so it seems more correct to scale the running time to > > reflect the effective amount of computation done since the last update. > > > > In order to be fully invariant, we need to apply the same amount of > > running time and idle time whatever the current capacity. Because running > > at lower capacity implies that the task will run longer, we have to ensure > > that the same amount of idle time will be apply when system becomes idle > > and no idle time has been "stolen". But reaching the maximum utilization > > value (SCHED_CAPACITY_SCALE) means that the task is seen as an > > always-running task whatever the capacity of the CPU (even at max compute > > capacity). In this case, we can discard this "stolen" idle times which > > becomes meaningless. > > > > In order to achieve this time scaling, a new clock_pelt is created per rq. > > The increase of this clock scales with current capacity when something > > is running on rq and synchronizes with clock_task when rq is idle. With > > this mecanism, we ensure the same running and idle time whatever the > > current capacity. > > Thinking about this new approach on a big.LITTLE platform: > > CPU Capacities big: 1024 LITTLE: 512, performance CPUfreq governor > > A 50% (runtime/period) task on a big CPU will become an always running > task on the little CPU. The utilization signal of the task and the > cfs_rq of the little CPU converges to 1024. > > With contrib scaling the utilization signal of the 50% task converges to > 512 on the little CPU, even it is always running on it, and so does the > one of the cfs_rq. > > Two 25% tasks on a big CPU will become two 50% tasks on a little CPU. > The utilization signal of the tasks converges to 512 and the one of the > cfs_rq of the little CPU converges to 1024. > > With contrib scaling the utilization signal of the 25% tasks converges > to 256 on the little CPU, even they run each 50% on it, and the one of > the cfs_rq converges to 512. > > So what do we consider system-wide invariance? I thought that e.g. a 25% > task should have a utilization value of 256 no matter on which CPU it is > running? > > In both cases, the little CPU is not going idle whereas the big CPU does. IMO, the key point here is that there is no idle time. As soon as there is no idle time, you don't know if a task has enough compute capacity so you can't make difference between the 50% running task or an always running task on the little core. That's also interesting to noticed that the task will reach the always running state after more than 600ms on little core with utilization starting from 0. Then considering the system-wide invariance, the task are not really invariant. If we take a 50% running task that run 40ms in a period of 80ms, the max utilization of the task will be 721 on the big core and 512 on the little core. Then, if you take a 39ms running task instead, the utilization on the big core will reach 709 but it will be 507 on little core. So your utilization depends on the current capacity With the new proposal, the max utilization will be 709 on big and little cores for the 39ms running task. For the 40ms running task, the utilization will be 721 on big core. then if the task moves on the little, it will reach the value 721 after 80ms, then 900 after more than 160ms and 1000 after 320ms