From patchwork Thu May 7 18:09:59 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Quentin Perret X-Patchwork-Id: 11534665 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D7AC6912 for ; Thu, 7 May 2020 18:11:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BF38921473 for ; Thu, 7 May 2020 18:11:20 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="buLQEpFY" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727799AbgEGSKV (ORCPT ); Thu, 7 May 2020 14:10:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55530 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726320AbgEGSKT (ORCPT ); Thu, 7 May 2020 14:10:19 -0400 Received: from mail-qk1-x749.google.com (mail-qk1-x749.google.com [IPv6:2607:f8b0:4864:20::749]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 053A5C05BD43 for ; Thu, 7 May 2020 11:10:18 -0700 (PDT) Received: by mail-qk1-x749.google.com with SMTP id 11so6680903qkh.7 for ; Thu, 07 May 2020 11:10:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=KCzP4bl+LsDIRE9Q4UUvX6EBmJ7sU8y+C6Dq7vCJhH8=; b=buLQEpFYJXDRA5yOOUN1Qv439Td9XdcBA8tv5KPRARKKfvPpsCXa/OGiesg1VlmuUi blDGxmJsXai8UyPSMxrDHjhxkit77Jj/4ySr1XgMT2k9ikcR9bYF4eRJXN97Oym5x3Mm g0d0AdY8/H2rxNvlriy3bU09kZxmXVHdY1EUyAt2D0ICjogDvlWZ8SaS4SxgowHGXnrJ zjVYurnBZTOolQWBNn0L3DoWL1ggGFySbJtZJ+WKh6PIs99yIJsX7LyUDI+D5NCruQhp XFuqjRQC5gpzIwYswzujFnzxHjlbr+c3SJpXiKKAwAJJz9fqFKP43I56hHQ3byQqbplU ujag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=KCzP4bl+LsDIRE9Q4UUvX6EBmJ7sU8y+C6Dq7vCJhH8=; b=EAnIP0gMfPCWLv1R5qr6AsHDISfraTZq1E3nTJ3J+pF2Yt1oGyOcfRxF0Z0t52YZie HDUXlF6hiGHn6cwg376Uc0AqGRbnmK2+pLrCSoLcP6gNQJvqUC2svIW7T0JJo/gkgJK9 6Vo+IU53Qox7FlrhFNf2Rb1Y1yBps3Ee2taie4MOWVUXpFQ26catJIHl3pVsCDaZ1zGR 5JvAVUAxtGKCCdOKOdKwt+rHB/RqwY0rdoB/rvH0VN1MxCednxWsHlv12d3mwJlGChVi yNYflIPFv9YG56xAtu5wopPWFFAIMsY3cLoUyvrUnpFUsGoOGmhLH1Ur3wHEBNIgW/v4 Ck0Q== X-Gm-Message-State: AGi0PubJgUt2V7A8+YGW7IYF2v4EH1M/7zeW5dLSTWTv3JJM/g2yiawd fBPNb0X43/9+JgYnlVVq5ofRX+NXu4Yy X-Google-Smtp-Source: APiQypKQhmCNyPtVGvHVeJln2UQbjcMKFZZasRoGbfH9naq6fFRrNf4dZOwRdFtzNL/pINDfbcBonxYb3hAe X-Received: by 2002:ad4:50c3:: with SMTP id e3mr13732268qvq.116.1588875017166; Thu, 07 May 2020 11:10:17 -0700 (PDT) Date: Thu, 7 May 2020 19:09:59 +0100 In-Reply-To: <20200507181012.29791-1-qperret@google.com> Message-Id: <20200507181012.29791-2-qperret@google.com> Mime-Version: 1.0 References: <20200507181012.29791-1-qperret@google.com> X-Mailer: git-send-email 2.26.2.526.g744177e7f7-goog Subject: [PATCH 01/14] sched: Provide sched_set_deadline() From: Quentin Perret To: linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org Cc: tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, x86@kernel.org, hpa@zytor.com, sudeep.holla@arm.com, gregkh@linuxfoundation.org, rafael@kernel.org, viresh.kumar@linaro.org, peterz@infradead.org, juri.lelli@redhat.com, vincent.guittot@linaro.org, dietmar.eggemann@arm.com, rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de, mcgrof@kernel.org, keescook@chromium.org, yzaikin@google.com, fweisbec@gmail.com, tkjos@google.com, kernel-team@android.com, qperret@google.com Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org As all the sched_setscheduler*() exports have been removed, introduce sched_set_deadline() on the model of sched_set_fifo() to enable modules to create SCHED_DEADLINE tasks. Signed-off-by: Quentin Perret --- include/linux/sched.h | 2 ++ kernel/sched/core.c | 17 +++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/include/linux/sched.h b/include/linux/sched.h index c0da93a26f62..63c8ae7a0dd8 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -1630,6 +1630,8 @@ extern int sched_setscheduler_nocheck(struct task_struct *, int, const struct sc extern void sched_set_fifo(struct task_struct *p); extern void sched_set_fifo_low(struct task_struct *p); extern void sched_set_normal(struct task_struct *p, int nice); +extern int sched_set_deadline(struct task_struct *p, u64 runtime, u64 deadline, + u64 period, u64 flags); extern int sched_setattr(struct task_struct *, const struct sched_attr *); extern int sched_setattr_nocheck(struct task_struct *, const struct sched_attr *); extern struct task_struct *idle_task(int cpu); diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 7324f3b0f8d2..dbaf3f63df22 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -5136,6 +5136,23 @@ void sched_set_normal(struct task_struct *p, int nice) } EXPORT_SYMBOL_GPL(sched_set_normal); +int sched_set_deadline(struct task_struct *p, u64 runtime, u64 deadline, + u64 period, u64 flags) +{ + struct sched_attr attr = { + .size = sizeof(struct sched_attr), + .sched_policy = SCHED_DEADLINE, + .sched_flags = flags, + .sched_nice = 0, + .sched_priority = 0, + .sched_runtime = runtime, + .sched_deadline = deadline, + .sched_period = period, + }; + return sched_setattr_nocheck(p, &attr); +} +EXPORT_SYMBOL_GPL(sched_set_deadline); + static int do_sched_setscheduler(pid_t pid, int policy, struct sched_param __user *param) { From patchwork Thu May 7 18:10:00 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Quentin Perret X-Patchwork-Id: 11534639 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 47CEB92A for ; Thu, 7 May 2020 18:10:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2F02720870 for ; Thu, 7 May 2020 18:10:22 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="ZhFfVBNH" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728003AbgEGSKV (ORCPT ); Thu, 7 May 2020 14:10:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55538 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726864AbgEGSKU (ORCPT ); Thu, 7 May 2020 14:10:20 -0400 Received: from mail-yb1-xb4a.google.com (mail-yb1-xb4a.google.com [IPv6:2607:f8b0:4864:20::b4a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5312AC05BD0A for ; Thu, 7 May 2020 11:10:20 -0700 (PDT) Received: by mail-yb1-xb4a.google.com with SMTP id z1so4234848ybm.5 for ; Thu, 07 May 2020 11:10:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=509wYnGQ2ll8bD7lPJSFtG4McPi0txJLxy0qvSv45Lo=; b=ZhFfVBNHUmUmHvR6RS1KKWKRBbqh0HTuUO7pHTeDUaozng1hAAZP9tIZ+8LZTZaau7 Z9IyHFYhb7tm2qWuEnfRILjVtXmrBUI68g930iuEC9carHiDuqJM0Q8hbwRfrYJOnMHr Mgiip6Sbjhz8csT4cQrv1o7W+McWrcFK2dCkrjLjttEyhQx5tBY2nv25d94p8HinQY69 bAq4kIJxs93uzLLprZ68fwclQpsOnpw9wzY5nEva6p8IaoAzV2FXlO1YO17homT1jj9v rUVm+1XOYjBQxScTdPenOUF48W1umyG+mIMEcfc8/IR/gUNAJXBdT9qI0TFZ+veEPlea yjwQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=509wYnGQ2ll8bD7lPJSFtG4McPi0txJLxy0qvSv45Lo=; b=NGQrvWw4Pu+CZawj+GfRsRKRdB1a0IRXKaGZitbE8wtobWCeF4AEsb7Xh/E7GNOfPl hFkRd9Qkqte+wiuBHH/RNyBjy6gBSSd1cx4zF+/QyPLKUTUeWMHlSP4nqhzdh4xhjxxh 7MUXoVfCjCbP24nwsHpnAFprpUqeSb1lHQZolys4SxzObpEtSWQ5B/FrI2y5pLscD9zq 1Rz6fMHTDThcOq49+tZ1BHU/WWF935nGCNe3svCd06ZBne+l43HP8FXZ2rebH3dZlqwc A4JuQswyUKDJawtWV6v88b8FwX/bgGi1XRzgGZNkDIRWAsJ9IcIPIU2ZBd1rv02NYHzM 9OPg== X-Gm-Message-State: AGi0PuZ1cPKg++RIc9PIvUuz6e8xUUUT7x5Q9sQ2FqNeaNHXa5kw0kO/ /dcmmko3leWpS6sMYnNaKeTHz/BF5U4m X-Google-Smtp-Source: APiQypJlZZ0Nv+hjKxeI5eVTKF6u8iZstKbYl+urYr+Vc4mwMoSpMjoTwgcq1KFh3BK9+P30QwuTBkg0l1kn X-Received: by 2002:a25:bb49:: with SMTP id b9mr26834376ybk.172.1588875019348; Thu, 07 May 2020 11:10:19 -0700 (PDT) Date: Thu, 7 May 2020 19:10:00 +0100 In-Reply-To: <20200507181012.29791-1-qperret@google.com> Message-Id: <20200507181012.29791-3-qperret@google.com> Mime-Version: 1.0 References: <20200507181012.29791-1-qperret@google.com> X-Mailer: git-send-email 2.26.2.526.g744177e7f7-goog Subject: [PATCH 02/14] sched: cpufreq: Use sched_set_deadline() from sugov From: Quentin Perret To: linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org Cc: tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, x86@kernel.org, hpa@zytor.com, sudeep.holla@arm.com, gregkh@linuxfoundation.org, rafael@kernel.org, viresh.kumar@linaro.org, peterz@infradead.org, juri.lelli@redhat.com, vincent.guittot@linaro.org, dietmar.eggemann@arm.com, rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de, mcgrof@kernel.org, keescook@chromium.org, yzaikin@google.com, fweisbec@gmail.com, tkjos@google.com, kernel-team@android.com, qperret@google.com Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org sched_set_deadline() is an exported symbol, use it instead of sched_setattr_nocheck() to elevate the sugov kthreads to DL. Signed-off-by: Quentin Perret --- kernel/sched/cpufreq_schedutil.c | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/kernel/sched/cpufreq_schedutil.c b/kernel/sched/cpufreq_schedutil.c index 7fbaee24c824..ebd5d30f0861 100644 --- a/kernel/sched/cpufreq_schedutil.c +++ b/kernel/sched/cpufreq_schedutil.c @@ -654,20 +654,6 @@ static void sugov_policy_free(struct sugov_policy *sg_policy) static int sugov_kthread_create(struct sugov_policy *sg_policy) { struct task_struct *thread; - struct sched_attr attr = { - .size = sizeof(struct sched_attr), - .sched_policy = SCHED_DEADLINE, - .sched_flags = SCHED_FLAG_SUGOV, - .sched_nice = 0, - .sched_priority = 0, - /* - * Fake (unused) bandwidth; workaround to "fix" - * priority inheritance. - */ - .sched_runtime = 1000000, - .sched_deadline = 10000000, - .sched_period = 10000000, - }; struct cpufreq_policy *policy = sg_policy->policy; int ret; @@ -685,7 +671,9 @@ static int sugov_kthread_create(struct sugov_policy *sg_policy) return PTR_ERR(thread); } - ret = sched_setattr_nocheck(thread, &attr); + /* Fake (unused) bandwidth; workaround to "fix" priority inheritance. */ + ret = sched_set_deadline(thread, 1000000, 10000000, 10000000, + SCHED_FLAG_SUGOV); if (ret) { kthread_stop(thread); pr_warn("%s: failed to set SCHED_DEADLINE\n", __func__); From patchwork Thu May 7 18:10:01 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Quentin Perret X-Patchwork-Id: 11534663 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B4BCD912 for ; Thu, 7 May 2020 18:11:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9BFB321835 for ; Thu, 7 May 2020 18:11:18 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="PGi9JzC7" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726913AbgEGSKY (ORCPT ); Thu, 7 May 2020 14:10:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55548 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1728073AbgEGSKX (ORCPT ); Thu, 7 May 2020 14:10:23 -0400 Received: from mail-qt1-x849.google.com (mail-qt1-x849.google.com [IPv6:2607:f8b0:4864:20::849]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8AFA9C05BD09 for ; Thu, 7 May 2020 11:10:22 -0700 (PDT) Received: by mail-qt1-x849.google.com with SMTP id d35so7690953qtc.20 for ; Thu, 07 May 2020 11:10:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=Vd0pNAUBaJ0yRt8OlUay21+ov1Ee3dhw97h0rn0JWzA=; b=PGi9JzC7BfRAuyN68vDloXznBqkKjDAhneADm5FudbrS4uv7r6kbQzRzv/pHSIZoMw NtiDu0RkmlxflfT2SJq0LixZXAcQCJ0qj22zqjD+SQpKVh58JFZ9ZS92Dsck3iDc+Dl7 s3E9uXSeRVa05+lLjb1M8OURbGdLy1lVqSgW0bQx5fm5Flhj7D4Xp8PdU5ruoSl271IE HLJqxU8UxYNeZ6vD+KZFXRx8oG3+OfDFxpzQc2MsMsff3wqOD4nuA4AWC0Y3DpRwKpsZ bJuEpiY+mf33+b06GwFin3o0YSJ9WV7xFkaUIqA1JzXutPno6QGi6l2lYmUIKC/Rr4X7 j/0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=Vd0pNAUBaJ0yRt8OlUay21+ov1Ee3dhw97h0rn0JWzA=; b=BuIP8/KRCYS34F7xfRMZiAT9gasJ9FjEuv5ghY3ww8Z3Ae80f3t3D3n62FzpIx00hR rv5iAwMpCsJkF3O8hCjTVOLpsyN8vkeIWwhAsQjngtreq30J1PO/UWffPbkatfwZs5AB dLfgeKp8tp0rF+Al+bJIyU8rIs5C3op2Olc0293GCBC3FQC4XR7joFoo/bGPvH2/KfAO LmBGlfvw38ThG4EO3XjePbqcptuGQ5cSiX7QbYbMDGl1GV/yy9QDj/pAfD4oxgk2XtXE CkLEfXbx6k8Ra7k4TE1sOScmuBzZPCHiipEx1T+HZl06Z/W8Opa5+8l1JwgglOq3TDku RvEQ== X-Gm-Message-State: AGi0Pua+qTm8sZ/zTKDcPu5AInSBbEuzRDlodGj6YKqRul3+dVbxPjEJ oQ/Q/9m+2zBfThFZ+P4NHchBd+g0ZUT+ X-Google-Smtp-Source: APiQypJ4asbJxd94fD3uQEhG1rWXpEeC3AokhHXEV9JcZ9jvjhTmwjtKJgFl4//ydqHlMQWqlkiT0Sn2NmAE X-Received: by 2002:a05:6214:158b:: with SMTP id m11mr14638091qvw.168.1588875021708; Thu, 07 May 2020 11:10:21 -0700 (PDT) Date: Thu, 7 May 2020 19:10:01 +0100 In-Reply-To: <20200507181012.29791-1-qperret@google.com> Message-Id: <20200507181012.29791-4-qperret@google.com> Mime-Version: 1.0 References: <20200507181012.29791-1-qperret@google.com> X-Mailer: git-send-email 2.26.2.526.g744177e7f7-goog Subject: [PATCH 03/14] sched: cpufreq: Introduce 'want_eas' governor flag From: Quentin Perret To: linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org Cc: tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, x86@kernel.org, hpa@zytor.com, sudeep.holla@arm.com, gregkh@linuxfoundation.org, rafael@kernel.org, viresh.kumar@linaro.org, peterz@infradead.org, juri.lelli@redhat.com, vincent.guittot@linaro.org, dietmar.eggemann@arm.com, rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de, mcgrof@kernel.org, keescook@chromium.org, yzaikin@google.com, fweisbec@gmail.com, tkjos@google.com, kernel-team@android.com, qperret@google.com Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org The EAS topology code requires the usage of schedutil on all CPUs of an rd to actually enable EAS balancing. However, the check implementing this references the schedutil_gov struct directly, which makes having schedutil as a module impractical. To prepare the ground for this modularization, introduce a new 'want_eas' flag in the cpufreq_governor struct, set it for schedutil only, and make sure to check it from the EAS topology code. Signed-off-by: Quentin Perret --- include/linux/cpufreq.h | 4 ++++ kernel/sched/cpufreq_schedutil.c | 5 ++++- kernel/sched/topology.c | 12 ++++++------ 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h index f7240251a949..267cc3b624da 100644 --- a/include/linux/cpufreq.h +++ b/include/linux/cpufreq.h @@ -560,6 +560,10 @@ struct cpufreq_governor { bool dynamic_switching; struct list_head governor_list; struct module *owner; + +#ifdef CONFIG_ENERGY_MODEL + bool want_eas; +#endif /* CONFIG_ENERGY_MODEL */ }; /* Pass a target to the cpufreq driver */ diff --git a/kernel/sched/cpufreq_schedutil.c b/kernel/sched/cpufreq_schedutil.c index ebd5d30f0861..c5e5045f7c81 100644 --- a/kernel/sched/cpufreq_schedutil.c +++ b/kernel/sched/cpufreq_schedutil.c @@ -888,6 +888,9 @@ struct cpufreq_governor schedutil_gov = { .start = sugov_start, .stop = sugov_stop, .limits = sugov_limits, +#ifdef CONFIG_ENERGY_MODEL + .want_eas = true, +#endif /* CONFIG_ENERGY_MODEL */ }; #ifdef CONFIG_CPU_FREQ_DEFAULT_GOV_SCHEDUTIL @@ -924,7 +927,7 @@ static DECLARE_WORK(rebuild_sd_work, rebuild_sd_workfn); void sched_cpufreq_governor_change(struct cpufreq_policy *policy, struct cpufreq_governor *old_gov) { - if (old_gov == &schedutil_gov || policy->governor == &schedutil_gov) { + if ((old_gov && old_gov->want_eas) || policy->governor->want_eas) { /* * When called from the cpufreq_register_driver() path, the * cpu_hotplug_lock is already held, so use a work item to diff --git a/kernel/sched/topology.c b/kernel/sched/topology.c index 8344757bba6e..b905f2e8d9b2 100644 --- a/kernel/sched/topology.c +++ b/kernel/sched/topology.c @@ -319,7 +319,8 @@ static void sched_energy_set(bool has_eas) * 2. the SD_ASYM_CPUCAPACITY flag is set in the sched_domain hierarchy. * 3. no SMT is detected. * 4. the EM complexity is low enough to keep scheduling overheads low; - * 5. schedutil is driving the frequency of all CPUs of the rd; + * 5. an EAS-compatible CPUfreq governor (schedutil) is driving the frequency + * of all CPUs of the rd; * * The complexity of the Energy Model is defined as: * @@ -339,7 +340,6 @@ static void sched_energy_set(bool has_eas) */ #define EM_MAX_COMPLEXITY 2048 -extern struct cpufreq_governor schedutil_gov; static bool build_perf_domains(const struct cpumask *cpu_map) { int i, nr_pd = 0, nr_cs = 0, nr_cpus = cpumask_weight(cpu_map); @@ -347,7 +347,7 @@ static bool build_perf_domains(const struct cpumask *cpu_map) int cpu = cpumask_first(cpu_map); struct root_domain *rd = cpu_rq(cpu)->rd; struct cpufreq_policy *policy; - struct cpufreq_governor *gov; + bool want_eas; if (!sysctl_sched_energy_aware) goto free; @@ -377,11 +377,11 @@ static bool build_perf_domains(const struct cpumask *cpu_map) policy = cpufreq_cpu_get(i); if (!policy) goto free; - gov = policy->governor; + want_eas = policy->governor && policy->governor->want_eas; cpufreq_cpu_put(policy); - if (gov != &schedutil_gov) { + if (!want_eas) { if (rd->pd) - pr_warn("rd %*pbl: Disabling EAS, schedutil is mandatory\n", + pr_warn("rd %*pbl: Disabling EAS because of incompatible CPUFreq governor\n", cpumask_pr_args(cpu_map)); goto free; } From patchwork Thu May 7 18:10:02 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Quentin Perret X-Patchwork-Id: 11534641 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 679C6912 for ; Thu, 7 May 2020 18:10:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4F0DE2495B for ; Thu, 7 May 2020 18:10:26 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="ZAAAK0RC" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728166AbgEGSKZ (ORCPT ); Thu, 7 May 2020 14:10:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55556 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1728164AbgEGSKZ (ORCPT ); Thu, 7 May 2020 14:10:25 -0400 Received: from mail-yb1-xb49.google.com (mail-yb1-xb49.google.com [IPv6:2607:f8b0:4864:20::b49]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A5B8EC05BD43 for ; Thu, 7 May 2020 11:10:24 -0700 (PDT) Received: by mail-yb1-xb49.google.com with SMTP id o134so7984954yba.18 for ; Thu, 07 May 2020 11:10:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=qiBNYuTTBahvA+prfWDH1NCGtPHc0+6kWQqaJheSr88=; b=ZAAAK0RCn7VnQh7zNRyMzcuefNSDFgTTf3/rCXZumrD/Gcltiy2N6K4zbxsWye8Xdb P8K5kvNyfByELwYSMW6BCQO93ulDr4bOkQZ51MXDaZwvYw3l6z+2b0XrJNFcnK3Yxkwe 48I6b37i9u/azMO/P1Xft++v9nPPBc0s9UHUebr2ady8fKubuzuQv+RPUaTS5CuLGSUp sz8+AgVIZUg+LCU5Ht4EhdSgZX4bAMyrCKKkhLb3ZKVoHwUnuV75cr+4Mqxi/FWne+TY Jb6nuGDS7zi3Z4N40FF3IWs2u/bmjFpwp6/iWFB+D7XqSy63HymEPP6pIgFhSdNSZFPJ YhbA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=qiBNYuTTBahvA+prfWDH1NCGtPHc0+6kWQqaJheSr88=; b=Retrtp8CFFSl7LJ540vOZOAIKaP8Qu0F4uoHyQIxjHd/eYvLLABMBDJtmoC44woABX zTkkpJzrRd+9DP4S+SAVCsaFA8JT7WNQd/cuSiEthKYqq/LJstZEMU0wPq8XlpE3N43D SZ5vUni4WfjNCFJvdrvdBGBiQ0zlvgL7E4jZmlloRDCiOZNpkYstfBI/l8O+k6AmHZJu nJOtyM1fXmpXl7zsob6dcU7ZPVgF3T0KIHADWXXSsEOwlTcd6ampuViVPpCV7a2GBnsi p7SdbnJbsxahdBHVHH7thfP2x+fDGB38Q5w0gq6I4XbpXE5BIz7XfHX5ZbuhhwRSNaS5 7xjw== X-Gm-Message-State: AGi0PuaQL3tn20DxjvF6x/+gPpiVH4QoHz4a+Hjdobbk4ouzeayigGos 77xiZ9hJs0Vt5eHpp81kYemh3ktr+98R X-Google-Smtp-Source: APiQypJ/t7O00c63w8CU/xSa4LGGxInSc6L4NyofnFjO6B4PNa2CJpc6zN2McrHb5oLO2nY20W1EIk9Oapa5 X-Received: by 2002:a5b:48c:: with SMTP id n12mr24758635ybp.133.1588875023827; Thu, 07 May 2020 11:10:23 -0700 (PDT) Date: Thu, 7 May 2020 19:10:02 +0100 In-Reply-To: <20200507181012.29791-1-qperret@google.com> Message-Id: <20200507181012.29791-5-qperret@google.com> Mime-Version: 1.0 References: <20200507181012.29791-1-qperret@google.com> X-Mailer: git-send-email 2.26.2.526.g744177e7f7-goog Subject: [PATCH 04/14] sched: cpufreq: Move sched_cpufreq_governor_change() From: Quentin Perret To: linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org Cc: tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, x86@kernel.org, hpa@zytor.com, sudeep.holla@arm.com, gregkh@linuxfoundation.org, rafael@kernel.org, viresh.kumar@linaro.org, peterz@infradead.org, juri.lelli@redhat.com, vincent.guittot@linaro.org, dietmar.eggemann@arm.com, rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de, mcgrof@kernel.org, keescook@chromium.org, yzaikin@google.com, fweisbec@gmail.com, tkjos@google.com, kernel-team@android.com, qperret@google.com Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org CPUFreq calls into sched_cpufreq_governor_change() when switching governors, which triggers a sched domain rebuild when entering or exiting schedutil. Move the function to sched/cpufreq.c to prepare the ground for the modularization of schedutil. Signed-off-by: Quentin Perret --- kernel/sched/cpufreq.c | 33 ++++++++++++++++++++++++++++++++ kernel/sched/cpufreq_schedutil.c | 33 -------------------------------- 2 files changed, 33 insertions(+), 33 deletions(-) diff --git a/kernel/sched/cpufreq.c b/kernel/sched/cpufreq.c index 7c2fe50fd76d..82f2dda61a55 100644 --- a/kernel/sched/cpufreq.c +++ b/kernel/sched/cpufreq.c @@ -75,3 +75,36 @@ bool cpufreq_this_cpu_can_update(struct cpufreq_policy *policy) (policy->dvfs_possible_from_any_cpu && rcu_dereference_sched(*this_cpu_ptr(&cpufreq_update_util_data))); } + +#ifdef CONFIG_ENERGY_MODEL +extern bool sched_energy_update; +extern struct mutex sched_energy_mutex; + +static void rebuild_sd_workfn(struct work_struct *work) +{ + mutex_lock(&sched_energy_mutex); + sched_energy_update = true; + rebuild_sched_domains(); + sched_energy_update = false; + mutex_unlock(&sched_energy_mutex); +} +static DECLARE_WORK(rebuild_sd_work, rebuild_sd_workfn); + +/* + * EAS shouldn't be attempted without sugov, so rebuild the sched_domains + * on governor changes to make sure the scheduler knows about it. + */ +void sched_cpufreq_governor_change(struct cpufreq_policy *policy, + struct cpufreq_governor *old_gov) +{ + if ((old_gov && old_gov->want_eas) || policy->governor->want_eas) { + /* + * When called from the cpufreq_register_driver() path, the + * cpu_hotplug_lock is already held, so use a work item to + * avoid nested locking in rebuild_sched_domains(). + */ + schedule_work(&rebuild_sd_work); + } + +} +#endif diff --git a/kernel/sched/cpufreq_schedutil.c b/kernel/sched/cpufreq_schedutil.c index c5e5045f7c81..33e67c48f668 100644 --- a/kernel/sched/cpufreq_schedutil.c +++ b/kernel/sched/cpufreq_schedutil.c @@ -905,36 +905,3 @@ static int __init sugov_register(void) return cpufreq_register_governor(&schedutil_gov); } core_initcall(sugov_register); - -#ifdef CONFIG_ENERGY_MODEL -extern bool sched_energy_update; -extern struct mutex sched_energy_mutex; - -static void rebuild_sd_workfn(struct work_struct *work) -{ - mutex_lock(&sched_energy_mutex); - sched_energy_update = true; - rebuild_sched_domains(); - sched_energy_update = false; - mutex_unlock(&sched_energy_mutex); -} -static DECLARE_WORK(rebuild_sd_work, rebuild_sd_workfn); - -/* - * EAS shouldn't be attempted without sugov, so rebuild the sched_domains - * on governor changes to make sure the scheduler knows about it. - */ -void sched_cpufreq_governor_change(struct cpufreq_policy *policy, - struct cpufreq_governor *old_gov) -{ - if ((old_gov && old_gov->want_eas) || policy->governor->want_eas) { - /* - * When called from the cpufreq_register_driver() path, the - * cpu_hotplug_lock is already held, so use a work item to - * avoid nested locking in rebuild_sched_domains(). - */ - schedule_work(&rebuild_sd_work); - } - -} -#endif From patchwork Thu May 7 18:10:03 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Quentin Perret X-Patchwork-Id: 11534659 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9AC5A912 for ; Thu, 7 May 2020 18:11:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7A85521473 for ; Thu, 7 May 2020 18:11:15 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="XuO5bWe/" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728230AbgEGSK2 (ORCPT ); Thu, 7 May 2020 14:10:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55570 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1728018AbgEGSK1 (ORCPT ); Thu, 7 May 2020 14:10:27 -0400 Received: from mail-qv1-xf49.google.com (mail-qv1-xf49.google.com [IPv6:2607:f8b0:4864:20::f49]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1A789C05BD43 for ; Thu, 7 May 2020 11:10:27 -0700 (PDT) Received: by mail-qv1-xf49.google.com with SMTP id dh14so6701033qvb.4 for ; Thu, 07 May 2020 11:10:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=qIuiAOvvRT8hmO6u7skiN+kIu86pFv2tJYmMai5+A9I=; b=XuO5bWe/BdA9l8ICcwd67xeqYKBHuj6SfFycygxA/YEJknsrtug6jcdtc5+o1CCB9T rnA7cboTm2jAjJkzYYiExhoFetKoql74YWzUDlNsCtoeU3Is/cIZ/Go05k2FQQGWhxG2 Tt/faoI7naq/erLMMyeByH2p22ZehudEVpQ61WHKaBoqHPXK6yn/GLHcncTLg7Nj54BQ AOjCgFi4Jprkdo8rl6ugwMMT8rcNH9Q6f1Ln7CnUXggC1Mx+PaGe9UHRS4yQTvTcmaHt PIV9Ks9HFOh4m82LgKue+7FeXVjaI6RprpGkOK58OsbWUgEHcKtD7hGbBlDmbxLBvH8A g3HQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=qIuiAOvvRT8hmO6u7skiN+kIu86pFv2tJYmMai5+A9I=; b=OKxsjHw0/7C1bumvBIzfM4d6IJHDYPpemIpS5GQIBqQCnD3RD6sF+mLib++QWqjnVr Hv8ROd0Y+6RFqTh+9wQoKAy4Q/Sw9KN4SoSSRIg/4VuYQFP5CxjcDT9eaF/8bX7uiOqj oeKAL4Qq80lq3eprCm1Q+o/25BRlzNQ60HyLjLWaZfBlTBxvfDEAYSJUuvwhqvTvpMpa IalpI16kKJwh9TAjqWOJQtzZgAwzxdlz1QGR5cHhcLnlAAb9ujyg5S9pDgG6mfPrbtZj lzUguOgMRgYlTpmXsc5rVMFsjyiZwus3gchDP0pcCBtrEDfp8wX8GgMJXtwo/JAC0cB+ pGqA== X-Gm-Message-State: AGi0PuaIHkMlbar2pACY6Mwo/cefOJlv7yIl1tg6Ee46gPNusZYXw2/J 1NSQZRjlOhgqiACYYjbpkw/CaxHsgT7v X-Google-Smtp-Source: APiQypIxeHB9B0PYPAzgCNlcFIYWdxDklpWlEPAZH+JGUvjzSqRKkgNbLdi3igaAuz0DTY1KWmcvioAv2CsG X-Received: by 2002:ad4:42c7:: with SMTP id f7mr15134043qvr.127.1588875026168; Thu, 07 May 2020 11:10:26 -0700 (PDT) Date: Thu, 7 May 2020 19:10:03 +0100 In-Reply-To: <20200507181012.29791-1-qperret@google.com> Message-Id: <20200507181012.29791-6-qperret@google.com> Mime-Version: 1.0 References: <20200507181012.29791-1-qperret@google.com> X-Mailer: git-send-email 2.26.2.526.g744177e7f7-goog Subject: [PATCH 05/14] sched: cpufreq: Move schedutil_cpu_util() From: Quentin Perret To: linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org Cc: tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, x86@kernel.org, hpa@zytor.com, sudeep.holla@arm.com, gregkh@linuxfoundation.org, rafael@kernel.org, viresh.kumar@linaro.org, peterz@infradead.org, juri.lelli@redhat.com, vincent.guittot@linaro.org, dietmar.eggemann@arm.com, rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de, mcgrof@kernel.org, keescook@chromium.org, yzaikin@google.com, fweisbec@gmail.com, tkjos@google.com, kernel-team@android.com, qperret@google.com Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org The CPU util aggregation code for schedutil and EAS currently resides in schedutil for historical reasons. However, this complicates modularizing schedutil as that would make the core kernel call into a (potential) module. While this could probably be done, it seems significantly simpler to move that function in fair.c directly, as it has no strong dependencies on schedutil anyway. And as an added benefit, that also enables that function to be marked as static, hence giving the compiler a chance to remove a few function calls from the wake-up path. While at it, rename the function to reflect the fact that it is not actually schedutil-specific, and remove the now unnecessary cpu_util_cfs(). Signed-off-by: Quentin Perret --- kernel/sched/cpufreq_schedutil.c | 109 +--------------------------- kernel/sched/fair.c | 118 ++++++++++++++++++++++++++++++- kernel/sched/sched.h | 32 ++------- 3 files changed, 120 insertions(+), 139 deletions(-) diff --git a/kernel/sched/cpufreq_schedutil.c b/kernel/sched/cpufreq_schedutil.c index 33e67c48f668..aeb04cc5b740 100644 --- a/kernel/sched/cpufreq_schedutil.c +++ b/kernel/sched/cpufreq_schedutil.c @@ -183,122 +183,15 @@ static unsigned int get_next_freq(struct sugov_policy *sg_policy, return cpufreq_driver_resolve_freq(policy, freq); } -/* - * This function computes an effective utilization for the given CPU, to be - * used for frequency selection given the linear relation: f = u * f_max. - * - * The scheduler tracks the following metrics: - * - * cpu_util_{cfs,rt,dl,irq}() - * cpu_bw_dl() - * - * Where the cfs,rt and dl util numbers are tracked with the same metric and - * synchronized windows and are thus directly comparable. - * - * The cfs,rt,dl utilization are the running times measured with rq->clock_task - * which excludes things like IRQ and steal-time. These latter are then accrued - * in the irq utilization. - * - * The DL bandwidth number otoh is not a measured metric but a value computed - * based on the task model parameters and gives the minimal utilization - * required to meet deadlines. - */ -unsigned long schedutil_cpu_util(int cpu, unsigned long util_cfs, - unsigned long max, enum schedutil_type type, - struct task_struct *p) -{ - unsigned long dl_util, util, irq; - struct rq *rq = cpu_rq(cpu); - - if (!IS_BUILTIN(CONFIG_UCLAMP_TASK) && - type == FREQUENCY_UTIL && rt_rq_is_runnable(&rq->rt)) { - return max; - } - - /* - * Early check to see if IRQ/steal time saturates the CPU, can be - * because of inaccuracies in how we track these -- see - * update_irq_load_avg(). - */ - irq = cpu_util_irq(rq); - if (unlikely(irq >= max)) - return max; - - /* - * Because the time spend on RT/DL tasks is visible as 'lost' time to - * CFS tasks and we use the same metric to track the effective - * utilization (PELT windows are synchronized) we can directly add them - * to obtain the CPU's actual utilization. - * - * CFS and RT utilization can be boosted or capped, depending on - * utilization clamp constraints requested by currently RUNNABLE - * tasks. - * When there are no CFS RUNNABLE tasks, clamps are released and - * frequency will be gracefully reduced with the utilization decay. - */ - util = util_cfs + cpu_util_rt(rq); - if (type == FREQUENCY_UTIL) - util = uclamp_rq_util_with(rq, util, p); - - dl_util = cpu_util_dl(rq); - - /* - * For frequency selection we do not make cpu_util_dl() a permanent part - * of this sum because we want to use cpu_bw_dl() later on, but we need - * to check if the CFS+RT+DL sum is saturated (ie. no idle time) such - * that we select f_max when there is no idle time. - * - * NOTE: numerical errors or stop class might cause us to not quite hit - * saturation when we should -- something for later. - */ - if (util + dl_util >= max) - return max; - - /* - * OTOH, for energy computation we need the estimated running time, so - * include util_dl and ignore dl_bw. - */ - if (type == ENERGY_UTIL) - util += dl_util; - - /* - * There is still idle time; further improve the number by using the - * irq metric. Because IRQ/steal time is hidden from the task clock we - * need to scale the task numbers: - * - * max - irq - * U' = irq + --------- * U - * max - */ - util = scale_irq_capacity(util, irq, max); - util += irq; - - /* - * Bandwidth required by DEADLINE must always be granted while, for - * FAIR and RT, we use blocked utilization of IDLE CPUs as a mechanism - * to gracefully reduce the frequency when no tasks show up for longer - * periods of time. - * - * Ideally we would like to set bw_dl as min/guaranteed freq and util + - * bw_dl as requested freq. However, cpufreq is not yet ready for such - * an interface. So, we only do the latter for now. - */ - if (type == FREQUENCY_UTIL) - util += cpu_bw_dl(rq); - - return min(max, util); -} - static unsigned long sugov_get_util(struct sugov_cpu *sg_cpu) { struct rq *rq = cpu_rq(sg_cpu->cpu); - unsigned long util = cpu_util_cfs(rq); unsigned long max = arch_scale_cpu_capacity(sg_cpu->cpu); sg_cpu->max = max; sg_cpu->bw_dl = cpu_bw_dl(rq); - return schedutil_cpu_util(sg_cpu->cpu, util, max, FREQUENCY_UTIL, NULL); + return cpu_util_freq(sg_cpu->cpu, max); } /** diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 02f323b85b6d..dadf0a060abe 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -6377,6 +6377,118 @@ static unsigned long cpu_util_without(int cpu, struct task_struct *p) return min_t(unsigned long, util, capacity_orig_of(cpu)); } +/* + * This function computes an effective utilization for the given CPU, to be + * used for frequency selection given the linear relation: f = u * f_max. + * + * The scheduler tracks the following metrics: + * + * cpu_util_{cfs,rt,dl,irq}() + * cpu_bw_dl() + * + * Where the cfs,rt and dl util numbers are tracked with the same metric and + * synchronized windows and are thus directly comparable. + * + * The cfs,rt,dl utilization are the running times measured with rq->clock_task + * which excludes things like IRQ and steal-time. These latter are then accrued + * in the irq utilization. + * + * The DL bandwidth number otoh is not a measured metric but a value computed + * based on the task model parameters and gives the minimal utilization + * required to meet deadlines. + */ +static unsigned long aggregate_cpu_util(int cpu, unsigned long util_cfs, + unsigned long max, + enum cpu_util_type type, + struct task_struct *p) +{ + unsigned long dl_util, util, irq; + struct rq *rq = cpu_rq(cpu); + + if (!IS_BUILTIN(CONFIG_UCLAMP_TASK) && + type == FREQUENCY_UTIL && rt_rq_is_runnable(&rq->rt)) { + return max; + } + + /* + * Early check to see if IRQ/steal time saturates the CPU, can be + * because of inaccuracies in how we track these -- see + * update_irq_load_avg(). + */ + irq = cpu_util_irq(rq); + if (unlikely(irq >= max)) + return max; + + /* + * Because the time spend on RT/DL tasks is visible as 'lost' time to + * CFS tasks and we use the same metric to track the effective + * utilization (PELT windows are synchronized) we can directly add them + * to obtain the CPU's actual utilization. + * + * CFS and RT utilization can be boosted or capped, depending on + * utilization clamp constraints requested by currently RUNNABLE + * tasks. + * When there are no CFS RUNNABLE tasks, clamps are released and + * frequency will be gracefully reduced with the utilization decay. + */ + util = util_cfs + cpu_util_rt(rq); + if (type == FREQUENCY_UTIL) + util = uclamp_rq_util_with(rq, util, p); + + dl_util = cpu_util_dl(rq); + + /* + * For frequency selection we do not make cpu_util_dl() a permanent part + * of this sum because we want to use cpu_bw_dl() later on, but we need + * to check if the CFS+RT+DL sum is saturated (ie. no idle time) such + * that we select f_max when there is no idle time. + * + * NOTE: numerical errors or stop class might cause us to not quite hit + * saturation when we should -- something for later. + */ + if (util + dl_util >= max) + return max; + + /* + * OTOH, for energy computation we need the estimated running time, so + * include util_dl and ignore dl_bw. + */ + if (type == ENERGY_UTIL) + util += dl_util; + + /* + * There is still idle time; further improve the number by using the + * irq metric. Because IRQ/steal time is hidden from the task clock we + * need to scale the task numbers: + * + * max - irq + * U' = irq + --------- * U + * max + */ + util = scale_irq_capacity(util, irq, max); + util += irq; + + /* + * Bandwidth required by DEADLINE must always be granted while, for + * FAIR and RT, we use blocked utilization of IDLE CPUs as a mechanism + * to gracefully reduce the frequency when no tasks show up for longer + * periods of time. + * + * Ideally we would like to set bw_dl as min/guaranteed freq and util + + * bw_dl as requested freq. However, cpufreq is not yet ready for such + * an interface. So, we only do the latter for now. + */ + if (type == FREQUENCY_UTIL) + util += cpu_bw_dl(rq); + + return min(max, util); +} + +unsigned long cpu_util_freq(int cpu, unsigned long max) +{ + return aggregate_cpu_util(cpu, cpu_util(cpu), max, FREQUENCY_UTIL, NULL); +} + /* * Predicts what cpu_util(@cpu) would return if @p was migrated (and enqueued) * to @dst_cpu. @@ -6449,7 +6561,7 @@ compute_energy(struct task_struct *p, int dst_cpu, struct perf_domain *pd) * is already enough to scale the EM reported power * consumption at the (eventually clamped) cpu_capacity. */ - sum_util += schedutil_cpu_util(cpu, util_cfs, cpu_cap, + sum_util += aggregate_cpu_util(cpu, util_cfs, cpu_cap, ENERGY_UTIL, NULL); /* @@ -6459,7 +6571,7 @@ compute_energy(struct task_struct *p, int dst_cpu, struct perf_domain *pd) * NOTE: in case RT tasks are running, by default the * FREQUENCY_UTIL's utilization can be max OPP. */ - cpu_util = schedutil_cpu_util(cpu, util_cfs, cpu_cap, + cpu_util = aggregate_cpu_util(cpu, util_cfs, cpu_cap, FREQUENCY_UTIL, tsk); max_util = max(max_util, cpu_util); } @@ -6556,7 +6668,7 @@ static int find_energy_efficient_cpu(struct task_struct *p, int prev_cpu) * IOW, placing the task there would make the CPU * overutilized. Take uclamp into account to see how * much capacity we can get out of the CPU; this is - * aligned with schedutil_cpu_util(). + * aligned with aggregate_cpu_util(). */ util = uclamp_rq_util_with(cpu_rq(cpu), util, p); if (!fits_capacity(util, cpu_cap)) diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h index db3a57675ccf..60592cde80e8 100644 --- a/kernel/sched/sched.h +++ b/kernel/sched/sched.h @@ -2397,10 +2397,9 @@ static inline unsigned long capacity_orig_of(int cpu) { return cpu_rq(cpu)->cpu_capacity_orig; } -#endif /** - * enum schedutil_type - CPU utilization type + * enum cpu_util_type - CPU utilization type * @FREQUENCY_UTIL: Utilization used to select frequency * @ENERGY_UTIL: Utilization used during energy calculation * @@ -2409,16 +2408,12 @@ static inline unsigned long capacity_orig_of(int cpu) * enum is used within schedutil_freq_util() to differentiate the types of * utilization expected by the callers, and adjust the aggregation accordingly. */ -enum schedutil_type { +enum cpu_util_type { FREQUENCY_UTIL, ENERGY_UTIL, }; -#ifdef CONFIG_CPU_FREQ_GOV_SCHEDUTIL - -unsigned long schedutil_cpu_util(int cpu, unsigned long util_cfs, - unsigned long max, enum schedutil_type type, - struct task_struct *p); +unsigned long cpu_util_freq(int cpu, unsigned long max); static inline unsigned long cpu_bw_dl(struct rq *rq) { @@ -2430,30 +2425,11 @@ static inline unsigned long cpu_util_dl(struct rq *rq) return READ_ONCE(rq->avg_dl.util_avg); } -static inline unsigned long cpu_util_cfs(struct rq *rq) -{ - unsigned long util = READ_ONCE(rq->cfs.avg.util_avg); - - if (sched_feat(UTIL_EST)) { - util = max_t(unsigned long, util, - READ_ONCE(rq->cfs.avg.util_est.enqueued)); - } - - return util; -} - static inline unsigned long cpu_util_rt(struct rq *rq) { return READ_ONCE(rq->avg_rt.util_avg); } -#else /* CONFIG_CPU_FREQ_GOV_SCHEDUTIL */ -static inline unsigned long schedutil_cpu_util(int cpu, unsigned long util_cfs, - unsigned long max, enum schedutil_type type, - struct task_struct *p) -{ - return 0; -} -#endif /* CONFIG_CPU_FREQ_GOV_SCHEDUTIL */ +#endif /* CONFIG_SMP */ #ifdef CONFIG_HAVE_SCHED_AVG_IRQ static inline unsigned long cpu_util_irq(struct rq *rq) From patchwork Thu May 7 18:10:04 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Quentin Perret X-Patchwork-Id: 11534661 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B8C7B14B4 for ; Thu, 7 May 2020 18:11:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A22F621835 for ; Thu, 7 May 2020 18:11:15 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="e0B6HuDQ" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726761AbgEGSLO (ORCPT ); Thu, 7 May 2020 14:11:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55580 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1728289AbgEGSK3 (ORCPT ); Thu, 7 May 2020 14:10:29 -0400 Received: from mail-yb1-xb49.google.com (mail-yb1-xb49.google.com [IPv6:2607:f8b0:4864:20::b49]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1FD65C05BD43 for ; Thu, 7 May 2020 11:10:29 -0700 (PDT) Received: by mail-yb1-xb49.google.com with SMTP id r14so7935864ybk.21 for ; Thu, 07 May 2020 11:10:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=8H2cxWc0TJkFq1FwnzU8BhlMDlLROEsVn8jQ63PO1YA=; b=e0B6HuDQFhjEiqKogDpB4FKzUc+1Dc5yC/vswLYEcVtDTUxUF+EebiB+Cc9J824OQs RHMC3zH1dbpw8rXc96BMLodYXjsjhq/iL6S9yrv9krOI2qjgV8bkOqbR5k6Y3nkMqEca zMbpy+PyilGMtP3Mexgi9bk3qNVRPHlEDtwyw+broZ/rkGpWZsFi+KhpXcTyOiir4g3e cKMsSunv87LNlGijr/lhKEAstYnvmmaTSOHAGEC3FRDPWnxqIu2U79KpfZJRjjtRTYHr sPQhmCCM9dUl6ZppLJLe8CKNIZE+or72DPVnWjlqbzcNapTLTPMNJim0aCsiIzNRDOTE hKJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=8H2cxWc0TJkFq1FwnzU8BhlMDlLROEsVn8jQ63PO1YA=; b=NLwbZkqAXIfRkb3tUoirQh+CQ2qaG+GgdrY4UYD2FZBKwQJb9qCTTEQCQSCB4GkKdR RR/NqU4dagfGSr1wQlodzdBu57lJ1pfs96s8yF+jfuduCRR89tI+RjpEdAwbdjnKNPO0 GymzHb7+wKTvqee38XQpdfvIL8uwlSCiwFUx5tqwQCq0WY+VS1Ti4wLYZ7a3x1bIHZmJ pgDAzwubDoDRfZSqKpu8zOjPPFjKINCiPhwpBlCSaKUDAH6HQ7jMapxoGDAjqNck46o5 I97L3J1jE1j+GHIrpnqyeH102qkyGbPsXNNWTFrTidwreobaxu7uZ6b0UJjQeX9tnCNl kAqQ== X-Gm-Message-State: AGi0PuYjSZb26my9S4zUhIRudk3Q6hNOdzOg2Yre/2ZRiSfA25Dy3dWK IGZVnsn97kpPvssDYYC+nww9kDZim5H2 X-Google-Smtp-Source: APiQypL5FceGu1rlwwmqFHesyQwSxJJabs9h5OpeREfdyyMJo/uIVD6Sh4CrmCFa5su+iSIK8etzgG3RTlxV X-Received: by 2002:a25:d80f:: with SMTP id p15mr24245303ybg.379.1588875028303; Thu, 07 May 2020 11:10:28 -0700 (PDT) Date: Thu, 7 May 2020 19:10:04 +0100 In-Reply-To: <20200507181012.29791-1-qperret@google.com> Message-Id: <20200507181012.29791-7-qperret@google.com> Mime-Version: 1.0 References: <20200507181012.29791-1-qperret@google.com> X-Mailer: git-send-email 2.26.2.526.g744177e7f7-goog Subject: [PATCH 06/14] arch_topology: Export cpu_scale per-cpu array From: Quentin Perret To: linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org Cc: tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, x86@kernel.org, hpa@zytor.com, sudeep.holla@arm.com, gregkh@linuxfoundation.org, rafael@kernel.org, viresh.kumar@linaro.org, peterz@infradead.org, juri.lelli@redhat.com, vincent.guittot@linaro.org, dietmar.eggemann@arm.com, rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de, mcgrof@kernel.org, keescook@chromium.org, yzaikin@google.com, fweisbec@gmail.com, tkjos@google.com, kernel-team@android.com, qperret@google.com Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org It will be needed by schedutil once modularized, export it. Signed-off-by: Quentin Perret --- drivers/base/arch_topology.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/base/arch_topology.c b/drivers/base/arch_topology.c index 4d0a0038b476..b1f0c272da67 100644 --- a/drivers/base/arch_topology.c +++ b/drivers/base/arch_topology.c @@ -48,6 +48,7 @@ void arch_set_freq_scale(struct cpumask *cpus, unsigned long cur_freq, } DEFINE_PER_CPU(unsigned long, cpu_scale) = SCHED_CAPACITY_SCALE; +EXPORT_SYMBOL_GPL(cpu_scale); void topology_set_cpu_scale(unsigned int cpu, unsigned long capacity) { From patchwork Thu May 7 18:10:05 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Quentin Perret X-Patchwork-Id: 11534657 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 634E692A for ; Thu, 7 May 2020 18:11:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4A230216FD for ; Thu, 7 May 2020 18:11:14 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="V1WGo7Fk" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728341AbgEGSKe (ORCPT ); Thu, 7 May 2020 14:10:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55588 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1728245AbgEGSKb (ORCPT ); Thu, 7 May 2020 14:10:31 -0400 Received: from mail-qt1-x84a.google.com (mail-qt1-x84a.google.com [IPv6:2607:f8b0:4864:20::84a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 47460C05BD43 for ; Thu, 7 May 2020 11:10:31 -0700 (PDT) Received: by mail-qt1-x84a.google.com with SMTP id j21so8100485qtq.8 for ; Thu, 07 May 2020 11:10:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=AcjgyLDbLfuRPfYfCs3xX2tel3iqkqWZ6prN5gsFA74=; b=V1WGo7FkR2BTf224rUb5QRFlyVtAEb490hVPQiagqofLxb2Un7HOf/lJzDMWR4dBaY goSk91EGW+FQMdpAJVpp9BCL7bztPmvctr4uif/kvn093HQ1ShZjG8EoS9jdhGl1/BZ8 uyafHnGr31hJEL3BWu0hNXUT3C479EPil+Q8kJAZ3VEgj4geeN+bZbgCvZQe5VG6NeXQ bK+RLFa3yo67keVKT6lXDjTpR9KIQRlqqx9MLvbeVPhoU3ibYvltd9C1qD3ffqxlY15X 18R22J/ldn5X2iJ7Qdm3RAQAavLDC0ea0wQ0O8QHDdIYStFzIstAlLdBGpV3e+H8Yjfe GxUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=AcjgyLDbLfuRPfYfCs3xX2tel3iqkqWZ6prN5gsFA74=; b=RmmoO46Tda73F+2hcPjJSEAlTbIUuX6DazpiDAf1Tg9qhWAZc3ib69TGun4rw0ksrt cuPUmJjzhTMrGf+rw2abhbuiyMEpRnAQdi28nn8NYVRhyeIpzVecAFrgyNf1Gl+GjTeR 4+JN+0f6Ap2Zc8Ad+2mZdNE8jdksh8d/2IneMEbTKEFpDntEBdrkrUo2/lqI/9rW4eXm 47TdfljgY5sueDBpNxDkUhJO0WQDtx2sYN5mhd8gBQd50uMVgif+5yiZpXzWJLfWRdj0 OsKVYB1OVFh4pWV/6tsbuQBIoGehAb0Ygkp6uCOIGVUR7WbwUV1+jP0/745Zd8m1j6D0 LA2g== X-Gm-Message-State: AGi0PuaydxVkOZncoGCKxwng7x/4GWvY5ZYWDm0TeiDPs5UkVTppfTDA zPKlG0oo/fGESylWynLgMqvt304xOkm1 X-Google-Smtp-Source: APiQypIeezwk8wKH5NFbxB1HRYZCWpSgPZOxn7vsJyIsBC8u1e/b/PRaJxwmopqEIxBGP+Ma+iemjLuU+rJg X-Received: by 2002:a0c:c28b:: with SMTP id b11mr14000646qvi.112.1588875030512; Thu, 07 May 2020 11:10:30 -0700 (PDT) Date: Thu, 7 May 2020 19:10:05 +0100 In-Reply-To: <20200507181012.29791-1-qperret@google.com> Message-Id: <20200507181012.29791-8-qperret@google.com> Mime-Version: 1.0 References: <20200507181012.29791-1-qperret@google.com> X-Mailer: git-send-email 2.26.2.526.g744177e7f7-goog Subject: [PATCH 07/14] kthread: Export kthread_bind_mask() From: Quentin Perret To: linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org Cc: tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, x86@kernel.org, hpa@zytor.com, sudeep.holla@arm.com, gregkh@linuxfoundation.org, rafael@kernel.org, viresh.kumar@linaro.org, peterz@infradead.org, juri.lelli@redhat.com, vincent.guittot@linaro.org, dietmar.eggemann@arm.com, rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de, mcgrof@kernel.org, keescook@chromium.org, yzaikin@google.com, fweisbec@gmail.com, tkjos@google.com, kernel-team@android.com, qperret@google.com Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org It will be needed by schedutil once modularized, export it. Signed-off-by: Quentin Perret --- kernel/kthread.c | 1 + 1 file changed, 1 insertion(+) diff --git a/kernel/kthread.c b/kernel/kthread.c index bfbfa481be3a..c0d84e1fbec2 100644 --- a/kernel/kthread.c +++ b/kernel/kthread.c @@ -430,6 +430,7 @@ void kthread_bind_mask(struct task_struct *p, const struct cpumask *mask) { __kthread_bind_mask(p, mask, TASK_UNINTERRUPTIBLE); } +EXPORT_SYMBOL_GPL(kthread_bind_mask); /** * kthread_bind - bind a just-created kthread to a cpu. From patchwork Thu May 7 18:10:06 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Quentin Perret X-Patchwork-Id: 11534655 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 43B1392A for ; Thu, 7 May 2020 18:11:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2B9BD21473 for ; Thu, 7 May 2020 18:11:13 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="ge96F09X" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728355AbgEGSKe (ORCPT ); Thu, 7 May 2020 14:10:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55602 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1728279AbgEGSKd (ORCPT ); Thu, 7 May 2020 14:10:33 -0400 Received: from mail-qt1-x849.google.com (mail-qt1-x849.google.com [IPv6:2607:f8b0:4864:20::849]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 502C2C05BD43 for ; Thu, 7 May 2020 11:10:33 -0700 (PDT) Received: by mail-qt1-x849.google.com with SMTP id v18so7681672qtq.22 for ; Thu, 07 May 2020 11:10:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=9OhNNPOR5bOJXqrXgYTR/z4ZLcIw94c7qBlgw12zehM=; b=ge96F09XdFsFsB5dYM9NSm1hEwRKTOm6LHBDxv4p756JWp8TiB91WkCmvrH5GpJ7ID R1VU3A76KGfuijtfRH6+xrVKU0ddCaeLZF07G8RQYkl68nCxyTdIXIQfY4W8gRGhbCod azIuW5jjVQqpdZInIkwMQBSRaUjl5Tu+cNcP1+KoCyvyGrxIzqKulY0Gn7TkwjziZ94Z BtRbwdywx5zzFJCVKWdH20zAP5GXCNqJLhSfhYgDYP5/Mm28PlWHVX30Ju4SOsih1iTY 7kpSk4677XwaHJJbNtMj+FUeOaemVnGoLjxIK5A4BsQxJR1aZ0j9uqW/oOpFjoP7CYkq VN1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=9OhNNPOR5bOJXqrXgYTR/z4ZLcIw94c7qBlgw12zehM=; b=EN/SaTlmYGcl+httFDxTdGR1JI6DrXXsvTiJAOjOF9UOPjrGdq9Hw+v212KF8u4MCe LKPlt2YT0ywI8YZhBH/4H33RmP48DR/x4kUdYRF7i4+9+bo+4n/QyEAj0WM7l32+7yew ZDRxgrbT2fEYqzOZpngjNqNSvdgv7BQAGMUcGJE9hxfOTiX4ohz8UO4er1C3Y/AI9Uyw 7AlwPmCTtckT+rusM5G0s9Ch1JPOiBxZSAplbgPttUki9+5J07aRRSFDwrQazxvHURN7 hRoQNTyfCym/QHalkduLqewdLc3ZgZV92LN6vKtaroVQBTt1Cn752EeqILjV2iUbesCn LNag== X-Gm-Message-State: AGi0Pub+pL+HW173tqu0mgXNVnmgqYn2NWPBk1PhlhXYVS8ac3M2KIkG myD26XtfhTSCAF18rfzpwcllhFL9+46Z X-Google-Smtp-Source: APiQypIiwLV5BbE0n5CUQvk0QJA7FNWdGbxWcAUCqDJsE+LSuluk52+DrvUSh3DwGlH7tJ6FU4zi3lidRXSp X-Received: by 2002:a0c:f50a:: with SMTP id j10mr13910437qvm.172.1588875032506; Thu, 07 May 2020 11:10:32 -0700 (PDT) Date: Thu, 7 May 2020 19:10:06 +0100 In-Reply-To: <20200507181012.29791-1-qperret@google.com> Message-Id: <20200507181012.29791-9-qperret@google.com> Mime-Version: 1.0 References: <20200507181012.29791-1-qperret@google.com> X-Mailer: git-send-email 2.26.2.526.g744177e7f7-goog Subject: [PATCH 08/14] sched/core: Export runqueues per-cpu array From: Quentin Perret To: linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org Cc: tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, x86@kernel.org, hpa@zytor.com, sudeep.holla@arm.com, gregkh@linuxfoundation.org, rafael@kernel.org, viresh.kumar@linaro.org, peterz@infradead.org, juri.lelli@redhat.com, vincent.guittot@linaro.org, dietmar.eggemann@arm.com, rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de, mcgrof@kernel.org, keescook@chromium.org, yzaikin@google.com, fweisbec@gmail.com, tkjos@google.com, kernel-team@android.com, qperret@google.com Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org It will be needed by schedutil once modularized, export it. Signed-off-by: Quentin Perret --- This is only needed for cpu_rq() -> cpu_bw_dl() in schedutil, so there is probably an alternative if exporting this isn't desirable. --- kernel/sched/core.c | 1 + 1 file changed, 1 insertion(+) diff --git a/kernel/sched/core.c b/kernel/sched/core.c index dbaf3f63df22..537eb45b4274 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -36,6 +36,7 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(pelt_se_tp); EXPORT_TRACEPOINT_SYMBOL_GPL(sched_overutilized_tp); DEFINE_PER_CPU_SHARED_ALIGNED(struct rq, runqueues); +EXPORT_SYMBOL_GPL(runqueues); #if defined(CONFIG_SCHED_DEBUG) && defined(CONFIG_JUMP_LABEL) /* From patchwork Thu May 7 18:10:07 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Quentin Perret X-Patchwork-Id: 11534653 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A6527912 for ; Thu, 7 May 2020 18:11:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8E8B121473 for ; Thu, 7 May 2020 18:11:11 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="VpHuDRD3" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728286AbgEGSLK (ORCPT ); Thu, 7 May 2020 14:11:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55610 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1728378AbgEGSKf (ORCPT ); Thu, 7 May 2020 14:10:35 -0400 Received: from mail-qt1-x849.google.com (mail-qt1-x849.google.com [IPv6:2607:f8b0:4864:20::849]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6F56BC05BD43 for ; Thu, 7 May 2020 11:10:35 -0700 (PDT) Received: by mail-qt1-x849.google.com with SMTP id z8so7691231qtu.17 for ; Thu, 07 May 2020 11:10:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=DfxtwXI8P8XYrWM5eaBon+8Miqx9tOiiT4uA5B/D10w=; b=VpHuDRD3x1EhaaRdJqrnbGTDyAXQO4MFmWH4pJHMS83w4ots6AXYPEFxqNMMm0qGZZ LFiJv4ekcAnYvmWhZGt06rYb+pN3owdaJPkkA/v0FeipJzuCvO10Jb/MwaRjTeMpt0UK t6OHkQnPhqLt4WpxTiuixQRnYh3LpnTulmrdKdCtsaeKYAPgKRqF1C8RLaT24hBj1j2E S/unIaQOkLs2Ga8pAx0Cwv8mml64n8ey3EGv0ST710vZNEz0elcR+8XMAJN+flMjlgMj LlOaEL39pa1UbV7CYf+18zzWcQVX3r4JyfjV9YIq/bFHDirTQUipLCaJ7glZdREobAiC JkXA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=DfxtwXI8P8XYrWM5eaBon+8Miqx9tOiiT4uA5B/D10w=; b=nLRpoN14lgL2TZ8gP4tDEWEf9Wa3yCEmh6TJ77Zru8fwlpXVlzxQ6BYARxaDPt7xEu zg+bRBo2mm5p7XRIyy3J3Z+vgzLzAah0lZm0JcaX3wRNs2HxrsHtdMJRd8lpCI6OA8kj ssepNtZCHwilgtfMHjoH8t2wI702K1U3EE5NKNhShKZLMD5pEhdCxfZELfM3Gk6h51ta sinXtdNDZGWxOsTLS+olQOzSktyhMUk1bgETC25h7zlJ8LcFyhkw1alFMdU90gm/RQbh lbKIZmkYR3RsEg/mtLey4Y42jTMo42R1lA2g7XybDZ2+cS72Ku8O2Jp72gkG+DtcFSBQ VUQg== X-Gm-Message-State: AGi0PuYK2AEEqxYmkgQBLmWmbNzwb9iV+3iBxOiTJojv2IRf2WwlPjZV mCtYH/5IyCFL7roTvXvfnJFlqCCB137l X-Google-Smtp-Source: APiQypISczuWnNG4La/XG2W8nFH7JeUZ2tqgh5D3kd/vIRdYL3gah5ZjsGOiYjkD93PCI2ZdBobicL9VO7GJ X-Received: by 2002:a05:6214:15d1:: with SMTP id p17mr15021011qvz.45.1588875034647; Thu, 07 May 2020 11:10:34 -0700 (PDT) Date: Thu, 7 May 2020 19:10:07 +0100 In-Reply-To: <20200507181012.29791-1-qperret@google.com> Message-Id: <20200507181012.29791-10-qperret@google.com> Mime-Version: 1.0 References: <20200507181012.29791-1-qperret@google.com> X-Mailer: git-send-email 2.26.2.526.g744177e7f7-goog Subject: [PATCH 09/14] sched/cpufreq: Export cpufreq_this_cpu_can_update() From: Quentin Perret To: linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org Cc: tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, x86@kernel.org, hpa@zytor.com, sudeep.holla@arm.com, gregkh@linuxfoundation.org, rafael@kernel.org, viresh.kumar@linaro.org, peterz@infradead.org, juri.lelli@redhat.com, vincent.guittot@linaro.org, dietmar.eggemann@arm.com, rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de, mcgrof@kernel.org, keescook@chromium.org, yzaikin@google.com, fweisbec@gmail.com, tkjos@google.com, kernel-team@android.com, qperret@google.com Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org It will be needed by schedutil once modularized, export it. Signed-off-by: Quentin Perret --- kernel/sched/cpufreq.c | 1 + 1 file changed, 1 insertion(+) diff --git a/kernel/sched/cpufreq.c b/kernel/sched/cpufreq.c index 82f2dda61a55..f4abe4e4e927 100644 --- a/kernel/sched/cpufreq.c +++ b/kernel/sched/cpufreq.c @@ -75,6 +75,7 @@ bool cpufreq_this_cpu_can_update(struct cpufreq_policy *policy) (policy->dvfs_possible_from_any_cpu && rcu_dereference_sched(*this_cpu_ptr(&cpufreq_update_util_data))); } +EXPORT_SYMBOL_GPL(cpufreq_this_cpu_can_update); #ifdef CONFIG_ENERGY_MODEL extern bool sched_energy_update; From patchwork Thu May 7 18:10:08 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Quentin Perret X-Patchwork-Id: 11534651 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 46187912 for ; Thu, 7 May 2020 18:11:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2E83224960 for ; Thu, 7 May 2020 18:11:09 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="cEOQlfEV" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728148AbgEGSLI (ORCPT ); Thu, 7 May 2020 14:11:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55620 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1728410AbgEGSKh (ORCPT ); Thu, 7 May 2020 14:10:37 -0400 Received: from mail-yb1-xb4a.google.com (mail-yb1-xb4a.google.com [IPv6:2607:f8b0:4864:20::b4a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7FA20C05BD43 for ; Thu, 7 May 2020 11:10:37 -0700 (PDT) Received: by mail-yb1-xb4a.google.com with SMTP id s8so7933814ybj.9 for ; Thu, 07 May 2020 11:10:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=4lcduyr6+J6gjW9QNJps5OFAxCiY2gXgkQhtQfZmlTA=; b=cEOQlfEVMyYdUWmraiQv6868nByrpJRpaaymVgBwUTg6wEdgwdIVUponU3hyLSlvTp 5fiab1SKPl//PLD9mpej/wjBU00SMNMDS/A6fS41QZb3XHBzUwGFrYDzviO9ErMIFElp LwjjpHOlYW87TavxsSdPCcg22n61ccvSbxkoFAZDeYUmjLjjj4SVs55GP1gwTD4sufrO 1E+2tAPiEMo1TUE9sizh8TCAFsd4mfShxMp1rSgIjvOIDptPPsdc8eHYXWVvI/Knbn3T e3CUlcs//sah/3XJ5uIYx6vHAdrtdPm6R0cTeDtF/EcwT6CcWJezEkkN2nUm9CU5LFel gO6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=4lcduyr6+J6gjW9QNJps5OFAxCiY2gXgkQhtQfZmlTA=; b=rxyE+tLSMDZiEqvN9IhCmJleoPyVFqe29pYGDPVFBMopYWmMsSjMkgrDxNxXSlFDRT Db6o46cchhXkyT0+YwuBqkd2rZoK3FLlEOk4H7g8zcKoyMLGLF0+wVMiIEE5u2Ia6kya Q0gne3wnZl4SA2GuoBUXiF6Iw6E11UyqMRbkE6Jm0Xn1aaPh6w6xxm4KTS1tRVjDzyLD qn4IDn8XIPB9szg5iO526uMD5fiIY3Z+GZqSyoeR+41U4p2G93ItKYHc3V/B+6fbb+wG PRKZXWX2HA3H/z1+T+zn/8TouPleXVVRsm1r0Og8LWaurTUBMwxB1pHD/rMcYVmo7nwt XgWg== X-Gm-Message-State: AGi0PubP1dgduL+cfGMjaFcE/aZCpxXzqEtkVuKXFUnzr4qlM09oe5EK XXjM0e8pH+p3NchJFuMduq5JpI9ynlAv X-Google-Smtp-Source: APiQypJPdsp8s/0FJ9HkF1hHrjGbTTy5ACV7cG92EmYwZKI6DWKFrz6S0o0PVs9GwAJo3DvMiOded7dIskOr X-Received: by 2002:a5b:707:: with SMTP id g7mr13422225ybq.489.1588875036707; Thu, 07 May 2020 11:10:36 -0700 (PDT) Date: Thu, 7 May 2020 19:10:08 +0100 In-Reply-To: <20200507181012.29791-1-qperret@google.com> Message-Id: <20200507181012.29791-11-qperret@google.com> Mime-Version: 1.0 References: <20200507181012.29791-1-qperret@google.com> X-Mailer: git-send-email 2.26.2.526.g744177e7f7-goog Subject: [PATCH 10/14] sched/fair: Export cpu_util_freq() From: Quentin Perret To: linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org Cc: tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, x86@kernel.org, hpa@zytor.com, sudeep.holla@arm.com, gregkh@linuxfoundation.org, rafael@kernel.org, viresh.kumar@linaro.org, peterz@infradead.org, juri.lelli@redhat.com, vincent.guittot@linaro.org, dietmar.eggemann@arm.com, rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de, mcgrof@kernel.org, keescook@chromium.org, yzaikin@google.com, fweisbec@gmail.com, tkjos@google.com, kernel-team@android.com, qperret@google.com Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org It will be needed by schedutil once modularized, export it. Signed-off-by: Quentin Perret --- kernel/sched/fair.c | 1 + 1 file changed, 1 insertion(+) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index dadf0a060abe..b7b43aeff969 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -6488,6 +6488,7 @@ unsigned long cpu_util_freq(int cpu, unsigned long max) { return aggregate_cpu_util(cpu, cpu_util(cpu), max, FREQUENCY_UTIL, NULL); } +EXPORT_SYMBOL_GPL(cpu_util_freq); /* * Predicts what cpu_util(@cpu) would return if @p was migrated (and enqueued) From patchwork Thu May 7 18:10:09 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Quentin Perret X-Patchwork-Id: 11534643 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 10CA0912 for ; Thu, 7 May 2020 18:10:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id EB4CE216FD for ; Thu, 7 May 2020 18:10:43 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="Hsq7csMm" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728465AbgEGSKm (ORCPT ); Thu, 7 May 2020 14:10:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55628 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1727117AbgEGSKl (ORCPT ); Thu, 7 May 2020 14:10:41 -0400 Received: from mail-qt1-x84a.google.com (mail-qt1-x84a.google.com [IPv6:2607:f8b0:4864:20::84a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A9B61C05BD43 for ; Thu, 7 May 2020 11:10:39 -0700 (PDT) Received: by mail-qt1-x84a.google.com with SMTP id g8so8148945qtq.2 for ; Thu, 07 May 2020 11:10:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=zZWvTUfx/wRuyyDcQxDeif3qbH8vMyyGM38ys5fdFsY=; b=Hsq7csMm3aKxHXFy3vU5SjedQTdFGmje4EFFn7pUNQI+7Tt5gipsk3gojrKeqv0oZA zKJmEc4qjOnoV2Poo1wux8oWp7druRmTRThDjQx0nXRmvka5WsF9eIK05U+G5BZ5kwA9 7QtfLulqPmZBLYbI0vKZu/6D5HO6i4g2a6I7enOxrKuX3hdzh9btnYC61l0lBlUK9g6G nIOYbvEzOurFENmE7JQ0pSeNgQ5IUaGVHwya8NGk1H3C8O8Gh3pvyYFCxt45XHtnr/q4 xHM22KlaIb+SQa38QzZsQOlVjsp4CDU+E/SvPDegyt/YmQrsmOX/1Q6cfHLV37HoscxQ DBqw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=zZWvTUfx/wRuyyDcQxDeif3qbH8vMyyGM38ys5fdFsY=; b=hRTUNlQyTSUqIMx4bZ79d23KgqeinRXb8eOE7UuN1AoF3WJuHYADk5zpK6466jz+9j FEsDi+RI6ajpJQ1X2NuQnj+dlaXgSkwwrCaSh0+iUhKcVE/nuxLnAtiTqnmBSAhEYyrO a549GaDsiqKqvAFf7jqXM6z6eEwXdN2v+ZEA90TjFyMCbvZt3psauqGE9oKKHRFtwcix JI7zwW0/+aJs+ecAl7hojaIpfm3Rz0LdvuRmOSXaWeimukpcG7YLT8u5g5KCcDui87QF XMH9+DjgZmVqnkKYYyxgHLyKY24HYOUG42lBzLx00C6PO4I/ovN7NqLj+ldFUjZedwBq PxPQ== X-Gm-Message-State: AGi0PuYIMEsYtaAXEu31NkqiQj5O6XZqxOpRu71i48kEKGwt6SuKQ65f 4jVKGCSxupjfJzu2UHqAgzgBxWgvyENe X-Google-Smtp-Source: APiQypLtVxYcoBCGLT2opMHxryNuYGnQnZvm1aIxlatafdQirXZzAlFCc71e959iGzwoL9cFGjpKT/1CxlGY X-Received: by 2002:a0c:facb:: with SMTP id p11mr14758771qvo.17.1588875038848; Thu, 07 May 2020 11:10:38 -0700 (PDT) Date: Thu, 7 May 2020 19:10:09 +0100 In-Reply-To: <20200507181012.29791-1-qperret@google.com> Message-Id: <20200507181012.29791-12-qperret@google.com> Mime-Version: 1.0 References: <20200507181012.29791-1-qperret@google.com> X-Mailer: git-send-email 2.26.2.526.g744177e7f7-goog Subject: [PATCH 11/14] tick/sched: Export tick_nohz_get_idle_calls_cpu From: Quentin Perret To: linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org Cc: tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, x86@kernel.org, hpa@zytor.com, sudeep.holla@arm.com, gregkh@linuxfoundation.org, rafael@kernel.org, viresh.kumar@linaro.org, peterz@infradead.org, juri.lelli@redhat.com, vincent.guittot@linaro.org, dietmar.eggemann@arm.com, rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de, mcgrof@kernel.org, keescook@chromium.org, yzaikin@google.com, fweisbec@gmail.com, tkjos@google.com, kernel-team@android.com, qperret@google.com Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org It will be needed by schedutil once modularized, export it. Signed-off-by: Quentin Perret --- kernel/time/tick-sched.c | 1 + 1 file changed, 1 insertion(+) diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c index 3e2dc9b8858c..3b1050cabb58 100644 --- a/kernel/time/tick-sched.c +++ b/kernel/time/tick-sched.c @@ -1122,6 +1122,7 @@ unsigned long tick_nohz_get_idle_calls_cpu(int cpu) return ts->idle_calls; } +EXPORT_SYMBOL_GPL(tick_nohz_get_idle_calls_cpu); /** * tick_nohz_get_idle_calls - return the current idle calls counter value From patchwork Thu May 7 18:10:10 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Quentin Perret X-Patchwork-Id: 11534649 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9463392A for ; Thu, 7 May 2020 18:11:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7BA1021473 for ; Thu, 7 May 2020 18:11:02 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="IlMzfBoi" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727084AbgEGSLB (ORCPT ); Thu, 7 May 2020 14:11:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55638 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1728466AbgEGSKm (ORCPT ); Thu, 7 May 2020 14:10:42 -0400 Received: from mail-yb1-xb4a.google.com (mail-yb1-xb4a.google.com [IPv6:2607:f8b0:4864:20::b4a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ABB58C05BD43 for ; Thu, 7 May 2020 11:10:41 -0700 (PDT) Received: by mail-yb1-xb4a.google.com with SMTP id n200so3378472ybg.0 for ; Thu, 07 May 2020 11:10:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=N7kuzoZFHLJw/s8kvulTGF06U3TOQxKeXMcbVwjE4XY=; b=IlMzfBoiBzByCTT8SvOpeFbpTRaCvxNWjvMZljPGk5OoeTwjsb1wsaeDG4gxHKaVQZ lzdyVKLAOhNQTDY9GjBd/yhOypV8xr6JkGrIdiIkOmuHYIEXWQlMLj/DbmLtNbgfFD9Q SCG7OJOOpIk03XjGXpiKFMyfX8aoQ3Xrqx3iegD2s+PpWCE+7K6lsm/S9bpA6HqJbgaR jMeJZirp1krHSjr5CW2MkZm66dBPji19T3oVp8Np6ywJUg8EpRdIfa2xNK2By97AoJkF MC053TSntRx44lPdMaRbtpYv7DwCxcWdZbSZKNuXslPDRHTEvdqxBA1WsqkBobm/WIUG gRLQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=N7kuzoZFHLJw/s8kvulTGF06U3TOQxKeXMcbVwjE4XY=; b=dNcxxWx5M8v0KP+71HF4Ynh5RAxO8o5fOmgWHV33Jf8n3NcLH67eFpnRZUcRyarmu3 yG/KWSBJ07UeIOZu+D/bPOH/KsRSYHrL40bj1v+Wv+Qn0Egt+9F4vsptBtiIWOnRfKla 1aINEOoYWvxHRJrwrW8G/RmqWZf78eQIPcPau4Z7D2g/22jsfKwfu+ZTKGo8dqW62LkF fwVlrOJk+3Tlrf2YlpahGbO/EfuTdccBwhgsMOIiZotmjRUszsMIYjmHpvnkznY9CEl/ wZTlaZD4SmrMHAc8hQadaPgEWsC+tOPPPeokyIAu35ebJy9SKx73GGtAfNljh1m+8+LZ SVPg== X-Gm-Message-State: AGi0PubBvm9pCxDX+pCKfBljxdduHrh+6BnZkBOrnF+SAn1nO+joAnBp M14IOjmMgeaPSnaW3QVzWX1kbaw5+zcD X-Google-Smtp-Source: APiQypJcn3oiy3Y8e0vbxO3XAex1LsJMYs5+fQTWEg+rN6GSDT89BK+2wbCqxMf6Oy2xk1QtZGIOh5nUJOcy X-Received: by 2002:a25:d2d8:: with SMTP id j207mr16831345ybg.517.1588875040927; Thu, 07 May 2020 11:10:40 -0700 (PDT) Date: Thu, 7 May 2020 19:10:10 +0100 In-Reply-To: <20200507181012.29791-1-qperret@google.com> Message-Id: <20200507181012.29791-13-qperret@google.com> Mime-Version: 1.0 References: <20200507181012.29791-1-qperret@google.com> X-Mailer: git-send-email 2.26.2.526.g744177e7f7-goog Subject: [PATCH 12/14] x86: Export arch_scale_freq_key From: Quentin Perret To: linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org Cc: tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, x86@kernel.org, hpa@zytor.com, sudeep.holla@arm.com, gregkh@linuxfoundation.org, rafael@kernel.org, viresh.kumar@linaro.org, peterz@infradead.org, juri.lelli@redhat.com, vincent.guittot@linaro.org, dietmar.eggemann@arm.com, rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de, mcgrof@kernel.org, keescook@chromium.org, yzaikin@google.com, fweisbec@gmail.com, tkjos@google.com, kernel-team@android.com, qperret@google.com Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org It will be needed by schedutil once modularized, export it. Signed-off-by: Quentin Perret --- arch/x86/kernel/smpboot.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c index 8c89e4d9ad28..a8ccd69ba5ff 100644 --- a/arch/x86/kernel/smpboot.c +++ b/arch/x86/kernel/smpboot.c @@ -1804,6 +1804,7 @@ void native_play_dead(void) */ DEFINE_STATIC_KEY_FALSE(arch_scale_freq_key); +EXPORT_SYMBOL_GPL(arch_scale_freq_key); static DEFINE_PER_CPU(u64, arch_prev_aperf); static DEFINE_PER_CPU(u64, arch_prev_mperf); From patchwork Thu May 7 18:10:11 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Quentin Perret X-Patchwork-Id: 11534645 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6851692A for ; Thu, 7 May 2020 18:10:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 489DF215A4 for ; Thu, 7 May 2020 18:10:48 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="voI6X5z1" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728477AbgEGSKq (ORCPT ); Thu, 7 May 2020 14:10:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55648 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1728364AbgEGSKp (ORCPT ); Thu, 7 May 2020 14:10:45 -0400 Received: from mail-qv1-xf49.google.com (mail-qv1-xf49.google.com [IPv6:2607:f8b0:4864:20::f49]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E780AC05BD43 for ; Thu, 7 May 2020 11:10:43 -0700 (PDT) Received: by mail-qv1-xf49.google.com with SMTP id ce16so6671830qvb.15 for ; Thu, 07 May 2020 11:10:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=1hVWpcQCBXlH3SqDBepJS0v9206DDLEbeu2byk1docE=; b=voI6X5z1oHfaGl+yun2YjFQ9wyIgV3UMOhZV6BqoY3yJQLB6FIKy5DXw7DhxmeXVwg zbed3tHC1jjQpgXtPPtaTDX1GiZxYpU/sbjaH2LcbbbWqBmJ3bRnMVvNrs0q4CFtUXhP iwKxxIpHw5VkKGPoiCi6LCR4Xi60EqcVfNVTZH5i7UFJSupsOqJt2Y5b888qYIFNlJV0 vpjDtq9fXzDF01SlrXMqZbF+IE3x9nT8QFCk6/Yob2XG9tABdHPXY9hm9rk5VZhx1u/9 8oRPRe4VztaYP+xyXKiXFF0O4rFD+V3eTGc0qz92cBzAGCCWBBMm4acNu9ZcMbdhGMmt 6VMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=1hVWpcQCBXlH3SqDBepJS0v9206DDLEbeu2byk1docE=; b=Shii0JyWgoxIIY4rCwfiXSSy5tKQnk4wOIi/XNX9qNbLZLLhXwCOFbwL5MyW5fqiab n5LGCOUq7S7K9O/26u3d84AXqsJR3RCo6Ym387+V1rF6w/EmblN21i9AxMKEeT70tPwf USlFEQUs75dPfqbUn7eyRJZyWC6JY8tsbcb7e7oqzPHZFufbWGCVa/mUPfglDPYHoQ4E r2QBz9oFM/wzY/MPgHD87QGDTD3lWBPcwgo2HjisVXYaoGAg4Mj1qEpAoDddtZ3arTPr WSa9qX0gqFIbwdtyUE8Q0YPbUuZFyDCSJF/ihjPECEB42LDJhylLGtjgqdvcD5Vxct5S uFiQ== X-Gm-Message-State: AGi0Pua8a2aU7J9bvOuuQ/534BudES9zRA0c57EvqBB8F+g8fGOAnKgs jVm1ijyMO03DFfTYLIXypqjInmmaV9VJ X-Google-Smtp-Source: APiQypI5EDf5t8r8O2JW1BDLkaew1g1NrIavX4ksxqmlBo9Mo0BH0ajd0rABhci5wzxC3jB7LEQhfhbfZ2NH X-Received: by 2002:a0c:f889:: with SMTP id u9mr13938607qvn.60.1588875043082; Thu, 07 May 2020 11:10:43 -0700 (PDT) Date: Thu, 7 May 2020 19:10:11 +0100 In-Reply-To: <20200507181012.29791-1-qperret@google.com> Message-Id: <20200507181012.29791-14-qperret@google.com> Mime-Version: 1.0 References: <20200507181012.29791-1-qperret@google.com> X-Mailer: git-send-email 2.26.2.526.g744177e7f7-goog Subject: [PATCH 13/14] sched: cpufreq: Use IS_ENABLED() for schedutil From: Quentin Perret To: linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org Cc: tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, x86@kernel.org, hpa@zytor.com, sudeep.holla@arm.com, gregkh@linuxfoundation.org, rafael@kernel.org, viresh.kumar@linaro.org, peterz@infradead.org, juri.lelli@redhat.com, vincent.guittot@linaro.org, dietmar.eggemann@arm.com, rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de, mcgrof@kernel.org, keescook@chromium.org, yzaikin@google.com, fweisbec@gmail.com, tkjos@google.com, kernel-team@android.com, qperret@google.com Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org The IS_ENABLED() macro evaluates to true when an option is set to =y or =m. As such, it is a good fit for tristate options. In preparation for modularizing schedutil, change all the related ifdefs to use IS_ENABLED(). Signed-off-by: Quentin Perret --- include/linux/cpufreq.h | 2 +- include/linux/sched/sysctl.h | 2 +- kernel/sched/sched.h | 4 ++-- kernel/sched/topology.c | 4 ++-- kernel/sysctl.c | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h index 267cc3b624da..c1176b8a0f61 100644 --- a/include/linux/cpufreq.h +++ b/include/linux/cpufreq.h @@ -983,7 +983,7 @@ static inline bool policy_has_boost_freq(struct cpufreq_policy *policy) } #endif -#if defined(CONFIG_ENERGY_MODEL) && defined(CONFIG_CPU_FREQ_GOV_SCHEDUTIL) +#if defined(CONFIG_ENERGY_MODEL) && IS_ENABLED(CONFIG_CPU_FREQ_GOV_SCHEDUTIL) void sched_cpufreq_governor_change(struct cpufreq_policy *policy, struct cpufreq_governor *old_gov); #else diff --git a/include/linux/sched/sysctl.h b/include/linux/sched/sysctl.h index d4f6215ee03f..704d971f204f 100644 --- a/include/linux/sched/sysctl.h +++ b/include/linux/sched/sysctl.h @@ -94,7 +94,7 @@ extern int sysctl_schedstats(struct ctl_table *table, int write, void __user *buffer, size_t *lenp, loff_t *ppos); -#if defined(CONFIG_ENERGY_MODEL) && defined(CONFIG_CPU_FREQ_GOV_SCHEDUTIL) +#if defined(CONFIG_ENERGY_MODEL) && IS_ENABLED(CONFIG_CPU_FREQ_GOV_SCHEDUTIL) extern unsigned int sysctl_sched_energy_aware; extern int sched_energy_aware_handler(struct ctl_table *table, int write, void __user *buffer, size_t *lenp, diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h index 60592cde80e8..087508723e58 100644 --- a/kernel/sched/sched.h +++ b/kernel/sched/sched.h @@ -217,7 +217,7 @@ static inline void update_avg(u64 *avg, u64 sample) static inline bool dl_entity_is_special(struct sched_dl_entity *dl_se) { -#ifdef CONFIG_CPU_FREQ_GOV_SCHEDUTIL +#if IS_ENABLED(CONFIG_CPU_FREQ_GOV_SCHEDUTIL) return unlikely(dl_se->flags & SCHED_FLAG_SUGOV); #else return false; @@ -2459,7 +2459,7 @@ unsigned long scale_irq_capacity(unsigned long util, unsigned long irq, unsigned } #endif -#if defined(CONFIG_ENERGY_MODEL) && defined(CONFIG_CPU_FREQ_GOV_SCHEDUTIL) +#if defined(CONFIG_ENERGY_MODEL) && IS_ENABLED(CONFIG_CPU_FREQ_GOV_SCHEDUTIL) #define perf_domain_span(pd) (to_cpumask(((pd)->em_pd->cpus))) diff --git a/kernel/sched/topology.c b/kernel/sched/topology.c index b905f2e8d9b2..5f49d25730bd 100644 --- a/kernel/sched/topology.c +++ b/kernel/sched/topology.c @@ -201,7 +201,7 @@ sd_parent_degenerate(struct sched_domain *sd, struct sched_domain *parent) return 1; } -#if defined(CONFIG_ENERGY_MODEL) && defined(CONFIG_CPU_FREQ_GOV_SCHEDUTIL) +#if defined(CONFIG_ENERGY_MODEL) && IS_ENABLED(CONFIG_CPU_FREQ_GOV_SCHEDUTIL) DEFINE_STATIC_KEY_FALSE(sched_energy_present); unsigned int sysctl_sched_energy_aware = 1; DEFINE_MUTEX(sched_energy_mutex); @@ -2287,7 +2287,7 @@ void partition_sched_domains_locked(int ndoms_new, cpumask_var_t doms_new[], ; } -#if defined(CONFIG_ENERGY_MODEL) && defined(CONFIG_CPU_FREQ_GOV_SCHEDUTIL) +#if defined(CONFIG_ENERGY_MODEL) && IS_ENABLED(CONFIG_CPU_FREQ_GOV_SCHEDUTIL) /* Build perf. domains: */ for (i = 0; i < ndoms_new; i++) { for (j = 0; j < n && !sched_energy_update; j++) { diff --git a/kernel/sysctl.c b/kernel/sysctl.c index 8a176d8727a3..e115bf26cdb0 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c @@ -475,7 +475,7 @@ static struct ctl_table kern_table[] = { .extra1 = SYSCTL_ONE, }, #endif -#if defined(CONFIG_ENERGY_MODEL) && defined(CONFIG_CPU_FREQ_GOV_SCHEDUTIL) +#if defined(CONFIG_ENERGY_MODEL) && IS_ENABLED(CONFIG_CPU_FREQ_GOV_SCHEDUTIL) { .procname = "sched_energy_aware", .data = &sysctl_sched_energy_aware, From patchwork Thu May 7 18:10:12 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Quentin Perret X-Patchwork-Id: 11534647 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1665D92A for ; Thu, 7 May 2020 18:11:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id F075221835 for ; Thu, 7 May 2020 18:11:00 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="OJ5DdgiC" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728229AbgEGSKw (ORCPT ); Thu, 7 May 2020 14:10:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55658 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1728487AbgEGSKr (ORCPT ); Thu, 7 May 2020 14:10:47 -0400 Received: from mail-qv1-xf4a.google.com (mail-qv1-xf4a.google.com [IPv6:2607:f8b0:4864:20::f4a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 18C53C05BD09 for ; Thu, 7 May 2020 11:10:46 -0700 (PDT) Received: by mail-qv1-xf4a.google.com with SMTP id d4so6641747qva.16 for ; Thu, 07 May 2020 11:10:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=tQJRWNXZ73jupkckFeVqSyiJPuHFNUXk3losPzo+jg0=; b=OJ5DdgiCF2sqkpLYesteMXNORwEGKDR0Y0KA0Y5rnVPYA7hNXSv1oL/MShKoOyUxtV ry7nKG2JXxTPRL9bLbxFdeT9Y2YqTlL4Fei31TaPiPOjMOkdUPfTils+SnDcvYFhfDJQ jjCzkIM36yfW/s841TyY6iK9sscitEH4sJ4DlMMBcV5YAQU5KOKQLO1T6Aa31KbeLycu LgOLgeWtLfvKc7O1SaUqq8AjMtDmYgxHFLOcjWdmib1seFPbUx4qpqmtUeU2/m1tBGXO m3ec7zNB0QRGtS6NtlA9VDThwYF7JCq4VENLUDeG20hKDR8IlSt+VL8f+ePs8xq03gJ3 LoJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=tQJRWNXZ73jupkckFeVqSyiJPuHFNUXk3losPzo+jg0=; b=QhXUSHTfdMBm7Sf516YbyA/EEgbtfVbot0aoujQQgPq7tkvPwDYnMpuLY1ZIe/SclK YEuqzs+ZCJH/gWIIQVH03Pq6Ge2+5FvlUOMIHFlYnLhFBBeP/B8OhRjNBH8gn7H+314i 2oBaJ1YVRIGAbpuhmPxZqfB1J3K7vCkWucbUYU8/bq6v9/KBhnYbkhwuIK3kxNDDEPQb 2VQOiSuBd7DfngtRQ4qzILVxxcark97GEaoJlDccR99HNoMfzCK+I+9cyfW2seeN87MV +G2ao43iuaBTdkTy3USFK3M8xB4fVmU7QPZ0Fe7B9JCrsA9N+eCCkt28C+Xa2F3jvZG3 f/mA== X-Gm-Message-State: AGi0PuaXbwF6r35NN4AVxQx9KzX+OLWwqQ1lQZtBcmZESpGwx53RrzG0 ITi3tfBbp5rORJYcw8hynuuIhx9712jz X-Google-Smtp-Source: APiQypLWF74i2ubQ61UdlGU8XHa46X4VRO8h//dR1bpYaMIS2zPs03r4Fxjeh4NMjh22GrvVAsE+nhm84qFL X-Received: by 2002:ad4:58eb:: with SMTP id di11mr14503909qvb.39.1588875045240; Thu, 07 May 2020 11:10:45 -0700 (PDT) Date: Thu, 7 May 2020 19:10:12 +0100 In-Reply-To: <20200507181012.29791-1-qperret@google.com> Message-Id: <20200507181012.29791-15-qperret@google.com> Mime-Version: 1.0 References: <20200507181012.29791-1-qperret@google.com> X-Mailer: git-send-email 2.26.2.526.g744177e7f7-goog Subject: [PATCH 14/14] sched: cpufreq: Modularize schedutil From: Quentin Perret To: linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org Cc: tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, x86@kernel.org, hpa@zytor.com, sudeep.holla@arm.com, gregkh@linuxfoundation.org, rafael@kernel.org, viresh.kumar@linaro.org, peterz@infradead.org, juri.lelli@redhat.com, vincent.guittot@linaro.org, dietmar.eggemann@arm.com, rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de, mcgrof@kernel.org, keescook@chromium.org, yzaikin@google.com, fweisbec@gmail.com, tkjos@google.com, kernel-team@android.com, qperret@google.com Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org Now that all requirements to modularize schedutil are met, make the Kconfig option tristate and add the missing MODULE_*() declarations in cpufreq_schedutil.c. Signed-off-by: Quentin Perret --- drivers/cpufreq/Kconfig | 2 +- kernel/sched/cpufreq_schedutil.c | 15 ++++++++++----- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/drivers/cpufreq/Kconfig b/drivers/cpufreq/Kconfig index c3e6bd59e920..49942f422a57 100644 --- a/drivers/cpufreq/Kconfig +++ b/drivers/cpufreq/Kconfig @@ -185,7 +185,7 @@ config CPU_FREQ_GOV_CONSERVATIVE If in doubt, say N. config CPU_FREQ_GOV_SCHEDUTIL - bool "'schedutil' cpufreq policy governor" + tristate "'schedutil' cpufreq policy governor" depends on CPU_FREQ && SMP select CPU_FREQ_GOV_ATTR_SET select IRQ_WORK diff --git a/kernel/sched/cpufreq_schedutil.c b/kernel/sched/cpufreq_schedutil.c index aeb04cc5b740..ea2778422efd 100644 --- a/kernel/sched/cpufreq_schedutil.c +++ b/kernel/sched/cpufreq_schedutil.c @@ -786,15 +786,20 @@ struct cpufreq_governor schedutil_gov = { #endif /* CONFIG_ENERGY_MODEL */ }; +static int __init sugov_register(void) +{ + return cpufreq_register_governor(&schedutil_gov); +} + #ifdef CONFIG_CPU_FREQ_DEFAULT_GOV_SCHEDUTIL struct cpufreq_governor *cpufreq_default_governor(void) { return &schedutil_gov; } +core_initcall(sugov_register); +#else +module_init(sugov_register); #endif -static int __init sugov_register(void) -{ - return cpufreq_register_governor(&schedutil_gov); -} -core_initcall(sugov_register); +MODULE_LICENSE("GPL v2"); +MODULE_DESCRIPTION("Schedutil CPUFreq Governor");