Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp2045802ybl; Sat, 11 Jan 2020 08:00:28 -0800 (PST) X-Google-Smtp-Source: APXvYqwrX/urTc10HLVvu4zHrskFL2Rx1t24x/kLW0eH6BLbNVCzttT1xzaYEeR2gsVLgbnJ1ut8 X-Received: by 2002:a05:6830:3003:: with SMTP id a3mr7071285otn.118.1578758428696; Sat, 11 Jan 2020 08:00:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578758428; cv=none; d=google.com; s=arc-20160816; b=pjeNK1YuX9bEnTYhhvbigVUg9BZTbqq3WTED+hbDoLWARSRfl3XaTkyaO45E1eoyXf e07NNArnA8l1rg/RJs9VyPyqTf9omPzWW/KJ6sWewjdy4wjAb4ScOueGLLbwDwPzT8lC dSKGXbtyqjEQ2pKeSk5MfzDzDHnEIyQ7xL3V7SX+6nFdA4Dfn99LZt0QULWvzocf6czY OeYteyhewD7GiqZXFt8xPfi/M2H0sbFoYI0GlIAhmvTZdhQwksU3PuMmaWcqkWo5YSAj ErhDw3vVprgEVz5+JNHX1imsqddHwQCifuRLvJGZUqC5GEGyzVMaeMs/HUJ5JvIGTuU9 w9gg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=BTewUQvHanfv4fZSXJWYXlMp1M1+mxVS9G9Ipk6ELlQ=; b=xu062MgAbmmHnAjELSuKwb5tbSelX8q7n9ov9orxeEZsNw0Q/JFFHv843t62zXowKW 6u1tDH2e/RxZ90EQW+TY+Bctu3JpBxxozpNJ9AaEHOcztp36qeji+bIe1H5YjUAn1PlR JhCLpZKgAo4H3IQdL0Tm/FvRyHzHciwdoSeIpHjhXL5bf07jLexP31fC/T6vo16N+TYa g1Zm/mD2H3ccsMhGFdMKgam+/A5lya4g3n05c8KLsnLamKWfieZYsk6ECV0++j+cegKF S0tNpXTqIKg2xFxKPyi35aFqI8D9vtRJFbc621r96gm8qC81vXfTuLZude4QVN2Q+kzu Uqsw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=nDlO0IDO; 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 m20si3728428otq.35.2020.01.11.08.00.16; Sat, 11 Jan 2020 08:00:28 -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=nDlO0IDO; 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 S1730307AbgAKP7U (ORCPT + 99 others); Sat, 11 Jan 2020 10:59:20 -0500 Received: from mail-qk1-f196.google.com ([209.85.222.196]:45661 "EHLO mail-qk1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730252AbgAKP7R (ORCPT ); Sat, 11 Jan 2020 10:59:17 -0500 Received: by mail-qk1-f196.google.com with SMTP id x1so4746851qkl.12 for ; Sat, 11 Jan 2020 07:59:16 -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; bh=BTewUQvHanfv4fZSXJWYXlMp1M1+mxVS9G9Ipk6ELlQ=; b=nDlO0IDO/0f+azAnHlojkW/cnYIpOn+cCXDQp4Nin6V/kogtybAFecbMDkySZWl4rU 4PAxB56Yo+fV8ptpxmsiZ/LpYPgzeqL9cLTMJzbGe1p4Tp5R2OVBhKExnxeNrDAqM/RM mhMXs21TgSj7PjdoYCILJUZJcULte6sV7P0/vJBKiR+fLEONsbugZi9wJ+iDAl0lW+K4 PTQQkE7VQES5F78kRuMAFYs13m70jHpsUPP9vOqOu8a+w3ZMUWKKe5JZc57Kg6DbyVZq fF+GB/XjysEDyNVAyQsOXt6AEiL8R7ZjOiw2WSvEHcDD4bH3gTi2Ao5iplrezDoXJD94 DFVw== 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; bh=BTewUQvHanfv4fZSXJWYXlMp1M1+mxVS9G9Ipk6ELlQ=; b=G1g6igYe6zaeny56lINcnWlGNPDAUhyo+4FPUlidYwdb1OXTWF7Ot3HhXT6Y6OK/qd HX+gAp8WMfGWVZhGH/q0N+EvcVaqdBOpqLN73DT1fsl+di+jfx7U4vKz3XRagFPYTV8i y99/g3sW6wJk1nRMzc6o1l2fa69dX1qUr4GnyJwJ5LlR/vwgPbwt1SwAZCWHyO2gZ95e z5JrdSxUdxeQqJyGAeIFZIGzedznDghmY3r+g4z26t8ZsUU7uTo7XOu3X+DZh2I4AQ71 ycyzJupXf7RyrPzE+gSFAI6wUzX8/uyFoAgoyj9QdNhVojUE48EaiEa6BwjoDAIAgoSf FG1w== X-Gm-Message-State: APjAAAUk6kNfh+I3LXFG6FJbLR0iSK1LHj6vLtOWwje0JNl5BCyCaGpz Rji4YATjYCAmeHJGnuM/vFVHrg== X-Received: by 2002:a05:620a:548:: with SMTP id o8mr8763638qko.490.1578758356092; Sat, 11 Jan 2020 07:59:16 -0800 (PST) Received: from Thara-Work-Ubuntu.fios-router.home (pool-71-255-246-27.washdc.fios.verizon.net. [71.255.246.27]) by smtp.googlemail.com with ESMTPSA id l49sm2843478qtk.7.2020.01.11.07.59.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 11 Jan 2020 07:59:15 -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 Cc: linux-kernel@vger.kernel.org, amit.kachhap@gmail.com, javi.merino@kernel.org, amit.kucheria@verdurent.com Subject: [Patch v7 5/7] sched/fair: update cpu_capacity to reflect thermal pressure Date: Sat, 11 Jan 2020 10:59:04 -0500 Message-Id: <1578758346-507-6-git-send-email-thara.gopinath@linaro.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1578758346-507-1-git-send-email-thara.gopinath@linaro.org> References: <1578758346-507-1-git-send-email-thara.gopinath@linaro.org> 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 actual maximum currently available capacity. Signed-off-by: Thara Gopinath --- v6->v7: Rewrote the patch description as per Ionela's suggestion. kernel/sched/fair.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 311bb0b..2b1fec3 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -7733,8 +7733,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 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 += READ_ONCE(rq->avg_thermal.load_avg); if (unlikely(used >= max)) return 1; -- 2.1.4