From patchwork Thu Dec 12 04:11:45 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thara Gopinath X-Patchwork-Id: 181433 Delivered-To: patch@linaro.org Received: by 2002:a92:3001:0:0:0:0:0 with SMTP id x1csp393942ile; Wed, 11 Dec 2019 20:12:11 -0800 (PST) X-Google-Smtp-Source: APXvYqxst1+OxX1wT9/vOi+PLtIoWBGddLUZG6C5UPEDzJFUbHxKdFK5JUcq9ycYVCGGoYsoV3XN X-Received: by 2002:a9d:798e:: with SMTP id h14mr5565194otm.257.1576123931438; Wed, 11 Dec 2019 20:12:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576123931; cv=none; d=google.com; s=arc-20160816; b=qhfwYtUijQwhH1mszjLqBfgRpnfPt0OPBwIIyfIiYMECGtJPkW/bi0gM9pjxTARTux AQcgh3ywlZ542Cn+g/7s+b5+nHBW8PMUXdxophdCsJOF+XhclMWLcJwhQ8mcmuyL6J0J IhXRmd84NF0yLc6Kd699Lpu8SUxJyuQnFBlkHl/l6TWc6ubUyXyr/0ER1kxbRZnWQUdz Qj/sCsh2Hzm9gLx3+LuqK7UGOj++GyDQqyRnUeWxAKybI0PIUg4YRNH5t5f2V/8/DXzL jUoaba3N7hTHZJMPLDCuUc4icuUxONX1HwMe+/lVZI0YbM31BrAv3z+CauTDpJe/RVDq WXvw== 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=Gp6DVIMwVoklcyjDkqg4ILNDJLNp+8FQvrp1u97hUfE=; b=Tfi5Tx4MQye6FlscPbcmwE4/hoC0wU1WC6vgW6W8FXcynPsNU3OLTjM4+9inoO4tk+ 78GljFFPWLfd3F0E8/zeqG16WiVjlF3VYt4IT+ZB7Geb340kHy7qr09T25/5/BoR7oLd npwQ4Kj52wIzl0QGe1omyxLD3cXMmWZuVZf0OIWjrv96j1pnbeGYs+oevzDlrgHEvNOJ G6KwfnR3CnKZE/9N6h8PFQYuYB0TVo9LYdqR1WBPHHK1yULA4jG4Lx56Xxn+ZMhihayQ uZ1nWQn0FfgtkEltS1yUDO1TNBt5LSztaLoRpBlfRmO3hE5HzqSsoWNqbr8+Al9xDzix mWsw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=lEzOn69h; 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 o206si257348oih.143.2019.12.11.20.12.11; Wed, 11 Dec 2019 20:12:11 -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=lEzOn69h; 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 S1726413AbfLLEMB (ORCPT + 27 others); Wed, 11 Dec 2019 23:12:01 -0500 Received: from mail-qk1-f194.google.com ([209.85.222.194]:45321 "EHLO mail-qk1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727923AbfLLEL4 (ORCPT ); Wed, 11 Dec 2019 23:11:56 -0500 Received: by mail-qk1-f194.google.com with SMTP id x1so500482qkl.12 for ; Wed, 11 Dec 2019 20:11:55 -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=Gp6DVIMwVoklcyjDkqg4ILNDJLNp+8FQvrp1u97hUfE=; b=lEzOn69h/8U6OZo0Ylkp+ZDqv3WQYnl2Rz1FCJbfSsBWYxPEW8OYeIjjl5mKle9K2H +EY9aUHhVK84JduAxF0LdxrQ6aj0dvIxhxHUEjmeLLPOi2uMwnoyjusbqSwUdfCA3Hkl geObQvsPEtfnqcm9dmPFdLgfJdj/peIpg3lpEsjNJHfW9KvxoFdZkpv3udkcbywhzuxK ZtAHbNq1q9Wq72K/QV84rZf+x7hWYw+NFivL+tAz4kc1mfu2jHduamdDhjx+aoSiZf63 NaMt1tbhDmXxbkiofYn90Cke/XRISuN4eyoI7SOtB3jNX+rKUT1MVa8u8urgpYVRE53l x60Q== 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=Gp6DVIMwVoklcyjDkqg4ILNDJLNp+8FQvrp1u97hUfE=; b=HgiKAtE2fOcQ/Mr1PFoSlBLvLcHL5a+mdo8FYp7EIxAu7OYG4fgC1OeNc1ks8SWwO2 YkACvnzwZtLryoIgE8hFFejzOd1DIFR9tMKXM9uWb9UgeG62GDSmc3SlT1n/MpKgyBPZ 17j/F7kZWt6kJgW7YJFxdamaXl48ZFPHoCuZTsFgmZLpnP/6KnimaNMOME2xLIGhMhkk aGEipW1yAuWQyfizJQVXmqJXArwy5MTU/y1zkSZtAo5FoFNoV40fyeCqnnvhLOBdsbEA kLJj0tGY3ymQ1YM/jqq6uIhtNVy3WgWe6DY/APf9NLCRWO1eh/Gu8h/hRe+OQMe/f7Ki DZBg== X-Gm-Message-State: APjAAAWllmL0U6bu7S4f9XDenoTBu6D40g10Xzk7SDolj8auKkY+wsCQ ncXTL5pT/kMRDtImDdObWoS7DQ== X-Received: by 2002:a37:a70b:: with SMTP id q11mr6171161qke.393.1576123915314; Wed, 11 Dec 2019 20:11:55 -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 s11sm1364126qkg.99.2019.12.11.20.11.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 11 Dec 2019 20:11:54 -0800 (PST) From: Thara Gopinath To: mingo@redhat.com, peterz@infradead.org, ionela.voinescu@arm.com, vincent.guittot@linaro.org, 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 v6 4/7] sched/fair: Enable periodic update of average thermal pressure Date: Wed, 11 Dec 2019 23:11:45 -0500 Message-Id: <1576123908-12105-5-git-send-email-thara.gopinath@linaro.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1576123908-12105-1-git-send-email-thara.gopinath@linaro.org> References: <1576123908-12105-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 Introduce support in CFS periodic tick and other bookkeeping apis to trigger the process of computing average thermal pressure for a cpu. Also consider avg_thermal.load_avg in others_have_blocked which allows for decay of pelt signals. Signed-off-by: Thara Gopinath --- kernel/sched/fair.c | 8 ++++++++ 1 file changed, 8 insertions(+) v4->v5: - Updated both versions of update_blocked_averages to trigger the process of computing average thermal pressure. - Updated others_have_blocked to considerd avg_thermal.load_avg. -- 2.1.4 diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 08a233e..e12a375 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -7462,6 +7462,9 @@ static inline bool others_have_blocked(struct rq *rq) if (READ_ONCE(rq->avg_dl.util_avg)) return true; + if (READ_ONCE(rq->avg_thermal.load_avg)) + return true; + #ifdef CONFIG_HAVE_SCHED_AVG_IRQ if (READ_ONCE(rq->avg_irq.util_avg)) return true; @@ -7487,6 +7490,7 @@ static bool __update_blocked_others(struct rq *rq, bool *done) { const struct sched_class *curr_class; u64 now = rq_clock_pelt(rq); + unsigned long thermal_pressure = arch_scale_thermal_capacity(cpu_of(rq)); bool decayed; /* @@ -7497,6 +7501,8 @@ static bool __update_blocked_others(struct rq *rq, bool *done) decayed = update_rt_rq_load_avg(now, rq, curr_class == &rt_sched_class) | update_dl_rq_load_avg(now, rq, curr_class == &dl_sched_class) | + update_thermal_load_avg(rq_clock_task(rq), rq, + thermal_pressure) | update_irq_load_avg(rq, 0); if (others_have_blocked(rq)) @@ -10263,6 +10269,7 @@ static void task_tick_fair(struct rq *rq, struct task_struct *curr, int queued) { struct cfs_rq *cfs_rq; struct sched_entity *se = &curr->se; + unsigned long thermal_pressure = arch_scale_thermal_capacity(cpu_of(rq)); for_each_sched_entity(se) { cfs_rq = cfs_rq_of(se); @@ -10274,6 +10281,7 @@ static void task_tick_fair(struct rq *rq, struct task_struct *curr, int queued) update_misfit_status(curr, rq); update_overutilized_status(task_rq(curr)); + update_thermal_load_avg(rq_clock_task(rq), rq, thermal_pressure); } /*