Received: by 10.192.165.148 with SMTP id m20csp461425imm; Fri, 20 Apr 2018 09:30:07 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+xt5lDfDYaAE1aWp5/+vTbLcObYAyOFKbx7MpBP+42nFayo+UIYZVRImyIdTDvsNI15w3r X-Received: by 2002:a17:902:2927:: with SMTP id g36-v6mr7990246plb.303.1524241807288; Fri, 20 Apr 2018 09:30:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524241807; cv=none; d=google.com; s=arc-20160816; b=wQE9/kOj6A4YlVHJ604y9/cW8X+kxRg2Axd9OtucoN5QgvG6ZyEKjoyoP+a1DaCl5D 5Y0hYAOsoexzd5QxnK4F9ieWHGYXqVrOWjwRH/e83+igvlK3V9vQtVF9VzmaSaoZ0j7w 6bdEkTQVOh0KPtf8SnDCA6HORkBocMLBaqd/k0Q56JC1k0WmLDiDQ/D/zjFAEWsNOdSV WHck6quGL3MGpvhx8BsldbnFRH56ghCFrWpJhaa/owQPxey1Ejpa9+JmVGZDTeN2nav6 gdnzqr2xQ5TC7f0G4cCfAPhBWWWoxgv9UGXesgyR2aNjfUhQMUWzywyuH97B87eO32P9 Lbiw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=g5ut3aEEa4Pn3K+jUxoPCcP7jDCd2WsBlNGL4R3gvqc=; b=oKddBRH1/kXs9DdsSeB3KjEF5rz4myrQKT/mDeb9ukGVtU3Pew2CWQiMvzXVqz5kcm ZVsAhmFozanguEKvNOkau0/MGp9q/FJnlBS1dZ3zSJdygYTZxDPXnuSUOfldZIUI31zF IYAMun6wQcf6Zy7AuWo3AFamXPm7oPNQ9uOIFxIwDiEX+ktREAd2GXzh79LfW2mG4GWf pAZiyezxxffw+oSOF/1CJWnY+qkEZZyJKBD1qQHmECc92eeh6BD4ke3tE0Zb5TFkjLfL efbmfHJ6ETH7SliMCmzvykxz6W6TzfHpguETINXxDnSlh29VhjQIIzNu+W3H8G7j4mEJ VGkg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=D2aFWXoh; 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 133si5012474pgc.341.2018.04.20.09.29.50; Fri, 20 Apr 2018 09:30:07 -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; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=D2aFWXoh; 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 S1752047AbeDTQ2I (ORCPT + 99 others); Fri, 20 Apr 2018 12:28:08 -0400 Received: from mail-wr0-f170.google.com ([209.85.128.170]:34920 "EHLO mail-wr0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751357AbeDTQ2G (ORCPT ); Fri, 20 Apr 2018 12:28:06 -0400 Received: by mail-wr0-f170.google.com with SMTP id w3-v6so24499765wrg.2 for ; Fri, 20 Apr 2018 09:28:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=g5ut3aEEa4Pn3K+jUxoPCcP7jDCd2WsBlNGL4R3gvqc=; b=D2aFWXohrvALMAiLrcpp6zwfXsKrfjtI2AH3WAcUavN59VFenhg4bzZjdaKHh4K+TY hUAdaNHF12anmOZWyoFciZbcZPskQAhq4Yc+pC1c/WQ8qpsLInXD3DSA0QTeMOEGBIvE 8NcqoaXRrST7tTbxWx2Fpn9f5j7d4qn+M8ZWs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=g5ut3aEEa4Pn3K+jUxoPCcP7jDCd2WsBlNGL4R3gvqc=; b=WY7vkmrzdFViTEeP8mxQrcL10NtF/i9h1cL/S75E713lYtKCMQU+Wlxeyhy+o03hAT WfTvT0mgrNyeQyvwyvRiwndJf09yu7Gy211AZqj2d43sJIcQmtwNmiWqD6xUD+8gyo64 S0xgy2dWKqmN86URUEcl2ejrjJxyscDnmZYA+65x8qtoUFcdrKUJE/9kQkAkOYSr6VF/ Zf94JRVrMbLIBLLlOk43ab8IMXh7Ft7xKl4sHEkCgHJ3wST108zEt+njQn9RJMFNjGxl 9xJnVMWz1EfPQgFMfG5berbGbuzwZhB1r92uDWD3hfcYz+DZ/67mA+6gMMr2rLD6NSNl b5LA== X-Gm-Message-State: ALQs6tC2x4Fj14I4E/hbxongHo6eLDCwCO01icGRVWhQNUKIYdR0YTcG nZcn2mG1mhRfO/XH3K82Y8RJ6SuoMdY= X-Received: by 2002:adf:e688:: with SMTP id r8-v6mr1177893wrm.90.1524241684892; Fri, 20 Apr 2018 09:28:04 -0700 (PDT) Received: from leoy-ThinkPad-X240s (li1489-133.members.linode.com. [139.162.172.133]) by smtp.gmail.com with ESMTPSA id q7-v6sm5755412wrf.92.2018.04.20.09.27.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 20 Apr 2018 09:28:03 -0700 (PDT) Date: Sat, 21 Apr 2018 00:27:53 +0800 From: Leo Yan To: Quentin Perret Cc: Dietmar Eggemann , linux-kernel@vger.kernel.org, Peter Zijlstra , Thara Gopinath , linux-pm@vger.kernel.org, Morten Rasmussen , Chris Redpath , Patrick Bellasi , Valentin Schneider , "Rafael J . Wysocki" , Greg Kroah-Hartman , Vincent Guittot , Viresh Kumar , Todd Kjos , Joel Fernandes , Juri Lelli , Steve Muckle , Eduardo Valentin Subject: Re: [RFC PATCH v2 4/6] sched/fair: Introduce an energy estimation helper function Message-ID: <20180420162753.GA5254@leoy-ThinkPad-X240s> References: <20180406153607.17815-1-dietmar.eggemann@arm.com> <20180406153607.17815-5-dietmar.eggemann@arm.com> <20180418121547.GC15682@leoy-ThinkPad-X240s> <20180420144245.GB14391@e108498-lin.cambridge.arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180420144245.GB14391@e108498-lin.cambridge.arm.com> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Apr 20, 2018 at 03:42:45PM +0100, Quentin Perret wrote: > Hi Leo, > > On Wednesday 18 Apr 2018 at 20:15:47 (+0800), Leo Yan wrote: > > Sorry I introduce mess at here to spread my questions in several > > replying, later will try to ask questions in one replying. Below are > > more questions which it's good to bring up: > > > > The code for energy computation is quite neat and simple, but I think > > the energy computation mixes two concepts for CPU util: one concept is > > the estimated CPU util which is used to select CPU OPP in schedutil, > > another concept is the raw CPU util according to CPU real running time; > > for example, cpu_util_next() predicts CPU util but this value might be > > much higher than cpu_util(), especially after enabled UTIL_EST feature > > (I have shallow understanding for UTIL_EST so correct me as needed); > > I'm not not sure to understand what you mean by higher than cpu_util() > here ... In which case would that happen ? After UTIL_EST feature is enabled, cpu_util_next() returns higher value than cpu_util(), see below code 'util = max(util, util_est);'; as result cpu_util_next() takes consideration for extra compensention introduced by UTIL_EST. if (sched_feat(UTIL_EST)) { util_est = READ_ONCE(cfs_rq->avg.util_est.enqueued); if (dst_cpu == cpu) util_est += _task_util_est(p); else util_est = max_t(long, util_est - _task_util_est(p), 0); util = max(util, util_est); } > cpu_util_next() is basically used to figure out what will be the > cpu_util() of CPU A after task p has been enqueued on CPU B (no matter > what A and B are). Same with upper description, cpu_util_next() is not the same thing with cpu_util(), cpu_util_next() takes consideration for extra compensention introduced by UTIL_EST. > > but this patch simply computes CPU capacity and energy with the single > > one CPU utilization value (and it will be an inflated value afte enable > > UTIL_EST). Is this purposed for simple implementation? > > > > IMHO, cpu_util_next() can be used to predict CPU capacity, on the other > > hand, should we use the CPU util without UTIL_EST capping for 'sum_util', > > this can be more reasonable to reflect the CPU utilization? > > Why would a decayed utilisation be a better estimate of the time that > a task is going to spend on a CPU ? IIUC, in the scheduler waken up path task_util() is the task utilisation before task sleeping, so it's not a decayed value. cpu_util() is decayed value, but is this just we want to reflect cpu historic utilisation at the recent past time? This is the reason I bring up to use 'cpu_util() + task_util()' as estimation. I understand this patch tries to use pre-decayed value, please review below example has issue or not: if one CPU's cfs_rq->avg.util_est.enqueued is quite high value, then this CPU enter idle state and sleep for long while, if we use cfs_rq->avg.util_est.enqueued to estimate CPU utilisation, this might have big deviation than the CPU run time if place wake task on it? On the other hand, cpu_util() can decay for CPU idle time... > > Furthermore, if we consider RT thread is running on CPU and connect with > > 'schedutil' governor, the CPU will run at maximum frequency, but we > > cannot say the CPU has 100% utilization. The RT thread case is not > > handled in this patch. > > Right, we don't account for RT tasks in the OPP prediction for now. > Vincent's patches to have a util_avg for RT runqueues could help us > do that I suppose ... Good to know this. > Thanks ! > Quentin