Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp2485597ybv; Fri, 21 Feb 2020 16:52:58 -0800 (PST) X-Google-Smtp-Source: APXvYqyJiey2hM66QIEDySR5vbviFt1oMpub4GjDnVjfTWZOuwSXaCStZVfLFDdkUcKIPhOVowb0 X-Received: by 2002:a9d:2c2a:: with SMTP id f39mr29904380otb.301.1582332778633; Fri, 21 Feb 2020 16:52:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582332778; cv=none; d=google.com; s=arc-20160816; b=u4o9kHARjqAiTB4Z8Y4YDNOc7if557c7YHLJp9OGZu1aQmWcFpvgCl7RlNHCrjdH0d SRwDcJVlfKYAZx39XIDLhW4CGsmwgC+8qtxRwi2oo0e0u6wlDfNfUFoP8zgIBfbrP/QN sbDoKbBnLHowIubtJQd9jgYXA/Uxe0JBvgUQsemD5kjYn8NKIdfnf5qnMFBFg6UXAEgX PwSOtGQQ+GKo2KZwlW0GIcrDH5zRphsS9y6AcpBOjwVOoIYXQ+CmPRqDhDbQbLZ3zecn EVBEfInF0yCjQuaUGzSiCEsZJ0lVv+dIJrkaBomhDKGCrDleV+kbICE4jzJAD725x2OL QMGQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=eU/3FEEqMRCv+cqTDac/hC8UNjSgSvHFY09GS+uFIIU=; b=V2PJ0NlfM03xuddN+b24RlmejctjYRB72KteXupqVjkO/Dm+dAWaWI8MkAEIoGrPKP cp3WrTifnMvSdSNNWI+8O37jFrJHjHWemcH15bNEEfuMpbxYcXBqYnCt52wuRmCrdRQQ X/nxhojrdcjIaqSTuA1DyhOW0jR5S756G5KqvqvUxxNPN+Qk0LK1WELvNmPB8OT1rj3x tU+oVFqEzaXKExQVvdI86ejg2tw7rsMzXrz+gefexRpmRNqAd3l41KopyUlshkrxi2cp 1JR+y7sLjKU1LM9AMkvsQgCL7XSmNfyPRKD/znEfw9gMvcEaSBGHturemF19K3r03Gme ykqQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=a1rvCpaY; 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 v18si1477837oic.188.2020.02.21.16.52.46; Fri, 21 Feb 2020 16:52:58 -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=a1rvCpaY; 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 S1727877AbgBVAwa (ORCPT + 99 others); Fri, 21 Feb 2020 19:52:30 -0500 Received: from mail-qt1-f196.google.com ([209.85.160.196]:39291 "EHLO mail-qt1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727851AbgBVAw1 (ORCPT ); Fri, 21 Feb 2020 19:52:27 -0500 Received: by mail-qt1-f196.google.com with SMTP id p34so2648651qtb.6 for ; Fri, 21 Feb 2020 16:52:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=eU/3FEEqMRCv+cqTDac/hC8UNjSgSvHFY09GS+uFIIU=; b=a1rvCpaYYbKr/Cb2GJymSSjj5ZybcUDGEmuy7iWbSm9scU559QF5yyGJ5JwcZuuZxP 3qHASBQJnAcA4gpH5Uf6YsrrefNIz3ZlJb9/HKDiFlzLuNpkSZN10KOrv3sHkZv5FhlX LWusTxxQWuaAq1MmUvHuK7BAuaPQ1MtblZi6bZ2PJJq/qOrXir1U9GJmYUIWJTc6kzLx GJu8qcBbIUVaCVx4CmTOhTl9yQ65/TQuli8gDRrtv19l0JNbTT/XjaVtT3mZ6dlv6Pc7 WDrdhdB+y5Tx6tb+cBuUJpojl9MWd2vj0Wg8T/FCZ8lGsSMJfTpA+VQ8+mHteh8xGEvF 0FEw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=eU/3FEEqMRCv+cqTDac/hC8UNjSgSvHFY09GS+uFIIU=; b=HhBBaIh4hxgawedFmPBtqqRT61nNDwrh5U2lX4vGQp23FiwQN1VksWvos2nAVHk5r6 YjVTXVfBJmjwOrluhy6vS13gXCreSz7njSBAIyezp0rSbivi04jSWMk+k9cZtmLZPrBo jZ5eMFhwGLY5YJRyL5hecuFLnKGBBbHaq9nUs5RNADhdbhImrdk9oGJjgVrc6LbcvE9S 84d4zh2NX91CbIaymIS/ngimJ8mCcWNsTO8KflDjF1Cn7+bxwJjpRooPJKZtPifIaP8w LvITfHxovOvllObJNqULU/JI+Vr2+O2s5gNNo6vLRo4XLcxXlS0WxVLcnbqiULCV+yXE SKNA== X-Gm-Message-State: APjAAAW16S68/S5icTM6cn+JcLPF9d5o17hvJVv26XKBhIprsen4yIu6 zvrJ6LX/FMlwmekYeeNwF4RexA== X-Received: by 2002:ac8:83d:: with SMTP id u58mr33792975qth.60.1582332745304; Fri, 21 Feb 2020 16:52:25 -0800 (PST) Received: from pop-os.fios-router.home (pool-71-255-246-27.washdc.fios.verizon.net. [71.255.246.27]) by smtp.googlemail.com with ESMTPSA id 12sm359559qkj.136.2020.02.21.16.52.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Feb 2020 16:52:24 -0800 (PST) From: Thara Gopinath To: mingo@redhat.com, peterz@infradead.org, ionela.voinescu@arm.com, vincent.guittot@linaro.org, dietmar.eggemann@arm.com, rui.zhang@intel.com, qperret@google.com, daniel.lezcano@linaro.org, viresh.kumar@linaro.org, rostedt@goodmis.org, will@kernel.org, catalin.marinas@arm.com, sudeep.holla@arm.com, juri.lelli@redhat.com, corbet@lwn.net Cc: linux-kernel@vger.kernel.org, amit.kachhap@gmail.com, javi.merino@kernel.org, amit.kucheria@verdurent.com Subject: [Patch v10 7/9] sched/fair: update cpu_capacity to reflect thermal pressure Date: Fri, 21 Feb 2020 19:52:11 -0500 Message-Id: <20200222005213.3873-8-thara.gopinath@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200222005213.3873-1-thara.gopinath@linaro.org> References: <20200222005213.3873-1-thara.gopinath@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org cpu_capacity initially reflects the maximum possible capacity of a cpu. Thermal pressure on a cpu means this maximum possible capacity is unavailable due to thermal events. This patch subtracts the average thermal pressure for a cpu from its maximum possible capacity so that cpu_capacity reflects the remaining maximum capacity. Signed-off-by: Thara Gopinath --- v8->v9: - Use thermal_load_avg to read rq->avg_thermal.load_avg. kernel/sched/fair.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 00b21a5b71f0..10e867e540ab 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -7800,8 +7800,15 @@ static unsigned long scale_rt_capacity(struct sched_domain *sd, int cpu) if (unlikely(irq >= max)) return 1; + /* + * avg_rt.util_avg and avg_dl.util_avg track binary signals + * (running and not running) with weights 0 and 1024 respectively. + * avg_thermal.load_avg tracks thermal pressure and the weighted + * average uses the actual delta max capacity(load). + */ used = READ_ONCE(rq->avg_rt.util_avg); used += READ_ONCE(rq->avg_dl.util_avg); + used += thermal_load_avg(rq); if (unlikely(used >= max)) return 1; -- 2.20.1