Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp941167ybp; Fri, 11 Oct 2019 06:47:20 -0700 (PDT) X-Google-Smtp-Source: APXvYqyc/95P69LO0u0P5TZ0U+dVOjwVDpnVhABR/NUHtZK7ysmNFA3eoEpu/71D1IeMPsrPuort X-Received: by 2002:a17:906:300a:: with SMTP id 10mr14063992ejz.104.1570801640078; Fri, 11 Oct 2019 06:47:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570801640; cv=none; d=google.com; s=arc-20160816; b=EYI5KkVxw/6a8xvTvn6T4Nk/J4d60hY1NVUHy5N4A4TTyEYHBh5O+x4e0H7evBdgCG a6D/8B4GCUCqL/e1pTYbwxx68OSycfjkmEPePqXpCLJ9FzZCCsvW/uNecV7EHWiMpQMT ud9+/4K8v06bPZG3o3o9px+Gnppx1XcjfVsC3+u8ItQQq8zbDe81T6ecsQqigcgH9vAF qjKdmlfQjm+4IHOlxA2UDCaiLi98HuDLPtzhiO3HLmpV60KJxedWvGbn0NFqov4JMxtN AerTZuB7VhLhSpkqQpoItH3tVkmcij5M0GV7RzJ2M4n1QQZ+JiFAMCNuxfufZSpdE0Bo flsw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=GeBvSJDL/lfMTPJao2/YSTEjXjC11wCnlOHu16qlLoY=; b=TYAsVM45fx7F7V4p7lFtbKZNY+2zgbvtqg53L+hPBMukKmRzLUPCMXqIEpp1D5U07r hithOqCzBdzmVxZBnfeu+65vOaWmS+YgHPn2KIE+zuamT/GjnPla8A0tIKGlzbpMZSlD YbGMP9SjKUZmd4aQHOOpVDdKtjvwMd4rNupWJYVuTU0yVUv17jjztC9W5Yvxj2VFkrZV TowSTkf8t4SQnA9VlJQX3WZl+jyRlTozOK0weFLoaQ6eAVl7hz995NkEZq4h35as7fDd jhfkICghS1VHDp8viUo/e80DPPHV/SdsZDA4NCEERooABw0RcmtBT1b3kuXhbuj4gKI2 +/2A== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k1si5687348ede.255.2019.10.11.06.46.56; Fri, 11 Oct 2019 06:47:20 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728678AbfJKNpm (ORCPT + 99 others); Fri, 11 Oct 2019 09:45:42 -0400 Received: from foss.arm.com ([217.140.110.172]:60910 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728594AbfJKNpk (ORCPT ); Fri, 11 Oct 2019 09:45:40 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id AA1721570; Fri, 11 Oct 2019 06:45:39 -0700 (PDT) Received: from e107049-lin.arm.com (e107049-lin.cambridge.arm.com [10.1.195.43]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 051BE3F68E; Fri, 11 Oct 2019 06:45:37 -0700 (PDT) From: Douglas RAILLARD To: linux-kernel@vger.kernel.org Cc: linux-pm@vger.kernel.org, mingo@redhat.com, peterz@infradead.org, rjw@rjwysocki.net, viresh.kumar@linaro.org, juri.lelli@redhat.com, vincent.guittot@linaro.org, douglas.raillard@arm.com, dietmar.eggemann@arm.com, qperret@qperret.net, patrick.bellasi@matbug.net, dh.han@samsung.com Subject: [RFC PATCH v3 3/6] sched/cpufreq: Hook em_pd_get_higher_power() into get_next_freq() Date: Fri, 11 Oct 2019 14:44:57 +0100 Message-Id: <20191011134500.235736-4-douglas.raillard@arm.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191011134500.235736-1-douglas.raillard@arm.com> References: <20191011134500.235736-1-douglas.raillard@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Choose the highest OPP for a given energy cost, allowing to skip lower frequencies that would not be cheaper in terms of consumed power. These frequencies can still be interesting to keep in the energy model to give more freedom to thermal throttling, but should not be selected under normal circumstances. This also prepares the ground for energy-aware frequency boosting. Signed-off-by: Douglas RAILLARD --- kernel/sched/cpufreq_schedutil.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/kernel/sched/cpufreq_schedutil.c b/kernel/sched/cpufreq_schedutil.c index 9abda58827c0..aab8c0498dd1 100644 --- a/kernel/sched/cpufreq_schedutil.c +++ b/kernel/sched/cpufreq_schedutil.c @@ -10,6 +10,7 @@ #include "sched.h" +#include #include #include @@ -208,9 +209,16 @@ static unsigned int get_next_freq(struct sugov_policy *sg_policy, struct cpufreq_policy *policy = sg_policy->policy; unsigned int freq = arch_scale_freq_invariant() ? policy->cpuinfo.max_freq : policy->cur; + struct em_perf_domain *pd = sugov_policy_get_pd(sg_policy); freq = map_util_freq(util, freq, max); + /* + * Try to get a higher frequency if one is available, given the extra + * power we are ready to spend. + */ + freq = em_pd_get_higher_freq(pd, freq, 0); + if (freq == sg_policy->cached_raw_freq && !sg_policy->need_freq_update) return sg_policy->next_freq; -- 2.23.0