Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp5064692ybl; Wed, 22 Jan 2020 09:37:48 -0800 (PST) X-Google-Smtp-Source: APXvYqy7Rq+8LQ+n+ch6idf9EB17yJfE3/0DJdRY+ixkhJzyILXxS99PVop4VzetWfdgWbjqNm8q X-Received: by 2002:aca:c30d:: with SMTP id t13mr7643054oif.166.1579714668113; Wed, 22 Jan 2020 09:37:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579714668; cv=none; d=google.com; s=arc-20160816; b=rDKrCYsubPYy4tklZFFxZyyL0oydt93eMV9ZVxZbpr9Bpn/STEipfoEr1tXdQarTl4 mNQWrFifiYGNti4/TWfWOHGp8usNC/JS/w9wHV4TTdDHJhQczpVhIV+ibo+huaoc295L 5p03VwgYZTbtay50cEeldt3mKYtLpbBcQQe0hoFEM93oxjIaoFO3sAGVRZLtL8N6k3eC fBNfcjNy8PNHGWt+cVC5Z3SnCdSxXfGJGpYGSl9XuxPCFlGheYZ2txJOlcCjAaabrkAA oBFzJ3gEhYvFh7VwJv8W8qGcXoA3zv0jwN3IljUZ9dqjjAj4WhZcXGBmcbUJSTyKRoVM 3vDQ== 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=D9OudP6s7+MBkA4urCg3CZxkAS/k9n0WsA49Kl63A78=; b=Q+8Yoiy7KeqZV7vSkuFAbjX/IiLFSGuKzitnywA7DU8a8ZX4b9D0O6g3Q6Q7Qd8sxq RbFX0BNuBrrOVc2x1TG2uaZ1K7EQwDcvRm8x6W8KhxdDz8Hh0La0Y1NUZQr2H5EZtB+3 f74YzYzIlZQch0kxWxK36iobxaAxecG+IkVZUm3pYntdbG3oXEs4JfCwr38x8rf9wUy0 tsPOKnyyISYtvcJdE92McfgIMW/PMH4TKunxUQ976WbFY3w+HyPI4XTCIvz0o4bfagt4 ZamwiR3rJWmbmlLaGaKgWurp2WTOBuG1RnCTAnBC427eqP/5uwKZesCSEt3IUKaPJpfo 2bBQ== 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 s13si23096364otd.186.2020.01.22.09.37.35; Wed, 22 Jan 2020 09:37:48 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; 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 S1729247AbgAVRgV (ORCPT + 99 others); Wed, 22 Jan 2020 12:36:21 -0500 Received: from foss.arm.com ([217.140.110.172]:59018 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725802AbgAVRgQ (ORCPT ); Wed, 22 Jan 2020 12:36:16 -0500 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 6B934113E; Wed, 22 Jan 2020 09:36:15 -0800 (PST) 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 1CE5B3F6C4; Wed, 22 Jan 2020 09:36:14 -0800 (PST) From: Douglas RAILLARD To: linux-kernel@vger.kernel.org, rjw@rjwysocki.net, viresh.kumar@linaro.org, peterz@infradead.org, juri.lelli@redhat.com, vincent.guittot@linaro.org Cc: douglas.raillard@arm.com, dietmar.eggemann@arm.com, qperret@google.com, linux-pm@vger.kernel.org Subject: [RFC PATCH v4 3/6] sched/cpufreq: Hook em_pd_get_higher_power() into get_next_freq() Date: Wed, 22 Jan 2020 17:35:35 +0000 Message-Id: <20200122173538.1142069-4-douglas.raillard@arm.com> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200122173538.1142069-1-douglas.raillard@arm.com> References: <20200122173538.1142069-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 09e284dc918a..608963da4916 100644 --- a/kernel/sched/cpufreq_schedutil.c +++ b/kernel/sched/cpufreq_schedutil.c @@ -10,6 +10,7 @@ #include "sched.h" +#include #include #include @@ -210,9 +211,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.24.1