Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp5332428yba; Wed, 8 May 2019 11:29:01 -0700 (PDT) X-Google-Smtp-Source: APXvYqwaX+QyhRTSNj9K0p2bHKdU0D/c5UehPkyo4tY8EeM19uA4MSGsIlyvrpft3ICouTX1g6vg X-Received: by 2002:a63:754b:: with SMTP id f11mr9952941pgn.32.1557340140920; Wed, 08 May 2019 11:29:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557340140; cv=none; d=google.com; s=arc-20160816; b=yam9FtEiyZJmPIyWBxSmMfPoDCBOcg9fcNdGdfh6nEyCoJxxPSwDQT1Hj5zUwJnAmU EePp0PsrotLZjNhsRweypAjYRbSYRPk9TnrrRqO0AId3H/TSkLodeOhcGCm6EsfDBWZv 6pyyNyByQdv9/Rg2VkrkyJzhT+vug/2H6eIlyVgQ5QdZunXmFlBxsDlYIeNR63/lOezW mNTFI3oayDntgmsl4fWCBTHD7Dj9Riw9ccF2beV939YP9aj5xE7g1THMjb4uewKN389W XNXvzaUpteNM/RuguFAd1pjlGJab5doQ3LfwtDKOTWLkxn5XdvoP0j28uFreQVPupg5J zRLQ== 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=NMjdoosXm6I4gb660NFYeqyjrVpv4HOWnoBFjX07R3c=; b=w9SMuqamw+gi7OjfLQyarHcf2A2RRoQHsiDkNRRnrXH73J7MhAByCYvd2qgcGwr5Qj ERwgWlVR9CGubmghwpoRogygM+4HekgaJBGjFbWlMm2LmuWHHnU6ij7zKP7sukcvnnXP l8Y5IXxCayqppKIqpHZPBKfbM3f0DsJy4rpK3qJWmhGXRxZZOICv8zLRW+ASm8Whd+Dg Ep4eY+c/RY0xWSDcQIfwgk+/J9Fgo8xfHmB4FHp3Gstkpm1ciWFCZBSYqpuoK2wsVUy2 O0komZnM/m7go3Pw+Cp/85eVf02wTKVWyvU+WtYpQUZxqqv0WThV49scPdOVVHHqpSgN ktmA== 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 i1si21964841pgq.528.2019.05.08.11.28.43; Wed, 08 May 2019 11:29:00 -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 S1729087AbfEHRnQ (ORCPT + 99 others); Wed, 8 May 2019 13:43:16 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:41808 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725910AbfEHRnO (ORCPT ); Wed, 8 May 2019 13:43:14 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 9045215AD; Wed, 8 May 2019 10:43:13 -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 166C03F575; Wed, 8 May 2019 10:43:11 -0700 (PDT) From: douglas.raillard@arm.com To: linux-kernel@vger.kernel.org Cc: linux-pm@vger.kernel.org, mingo@redhat.com, peterz@infradead.org, quentin.perret@arm.com, douglas.raillard@arm.com, patrick.bellasi@arm.com, dietmar.eggemann@arm.com Subject: [RFC PATCH 3/7] sched/cpufreq: Hook em_pd_get_higher_power() into get_next_freq() Date: Wed, 8 May 2019 18:42:57 +0100 Message-Id: <20190508174301.4828-4-douglas.raillard@arm.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190508174301.4828-1-douglas.raillard@arm.com> References: <20190508174301.4828-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 From: Douglas RAILLARD 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 | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/kernel/sched/cpufreq_schedutil.c b/kernel/sched/cpufreq_schedutil.c index 82dbacf83649..f4173a7c0f01 100644 --- a/kernel/sched/cpufreq_schedutil.c +++ b/kernel/sched/cpufreq_schedutil.c @@ -10,6 +10,7 @@ #include "sched.h" +#include #include #include @@ -200,9 +201,19 @@ 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); + + /* Maximum power we are ready to spend. */ + unsigned int cost_margin = 0; 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, cost_margin); + if (freq == sg_policy->cached_raw_freq && !sg_policy->need_freq_update) return sg_policy->next_freq; -- 2.21.0