Received: by 2002:a25:f815:0:0:0:0:0 with SMTP id u21csp2317419ybd; Thu, 27 Jun 2019 10:18:11 -0700 (PDT) X-Google-Smtp-Source: APXvYqyof5AdrNlcsAw9bbyz8qjmDduRP1x690oGYRxHeb/N+5EOLNfaiNF7Hh2rgYCUeASIJRv5 X-Received: by 2002:a17:902:4c:: with SMTP id 70mr5866336pla.308.1561655891528; Thu, 27 Jun 2019 10:18:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561655891; cv=none; d=google.com; s=arc-20160816; b=JhquTVkf6uERSANtgFa5fj7r82nt8o6xyfzrVUHKFWsJFHV+lFs8r0J/L244++TkkJ fEfH/hAR06mPtSfikVndELp377YHhIcxL9TIq3yOyMUhgu/9Xk8aPSw0Zv9BB/j+N5L6 BoOANoLerqjFF4RhxnFL+Lt3ocFuMfBEQT5I/DiZtS92ixbmpPmv7PLXmj+fnfnHZM8x hCi5K70eK3GOdhmh04WpSVptgRtVTFJYzI2rVaJkvYZz/rCeEEdAyPs8gjHXASbGOL67 jCaORNJKSeDd02IFLMo1erkW+HxRPWHcb5wFTY5cjQPZhgcM7KNDkrgfAuBZRUZOXABL Ihfw== 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=LxIy6NvC1i2RsEViNZCLpEuDnHQZ8UTP19SVMKCSYIw=; b=eiHE65QCroUL6eD3Q76jZhyxA/5jBpgS3OzhYnSBWAG+UoorBj2dLwL/XP+lIr8dHp +i8wUhf2ydTYyAut6Le1m26IvPGuYqXA4kvCQ9zSk9i7YMnti6wgW7yRz6sXWTHaO8HM edSv4Cy+Hn/81/PWVB3LA+/XHOzbtatVysmtzSFM7fuEndd5M6T0GVX53vxR3eIMAnh9 ffFaYMLsYDfY9G8I4zqC1SNCJZu7XkOVnrUjhXBdm0Xduy8TBGHYdj82rxf2QUeqa4V4 4EFZUZltn/AreVyJaNzqZJ86Owu9rFbBquewQSfwwtQNUWGzBibP22CijwVvwQTP7vXE bYSQ== 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 w10si2752807plq.403.2019.06.27.10.17.54; Thu, 27 Jun 2019 10:18:11 -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 S1726666AbfF0RQZ (ORCPT + 99 others); Thu, 27 Jun 2019 13:16:25 -0400 Received: from foss.arm.com ([217.140.110.172]:59240 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726619AbfF0RQX (ORCPT ); Thu, 27 Jun 2019 13:16:23 -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 857E01477; Thu, 27 Jun 2019 10:16:22 -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 2EFFD3F718; Thu, 27 Jun 2019 10:16:21 -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, quentin.perret@arm.com, douglas.raillard@arm.com, patrick.bellasi@arm.com, dietmar.eggemann@arm.com Subject: [RFC PATCH v2 3/5] sched/cpufreq: Hook em_pd_get_higher_power() into get_next_freq() Date: Thu, 27 Jun 2019 18:16:01 +0100 Message-Id: <20190627171603.14767-4-douglas.raillard@arm.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190627171603.14767-1-douglas.raillard@arm.com> References: <20190627171603.14767-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 0a3ccc20adeb..7ffc6fe3b670 100644 --- a/kernel/sched/cpufreq_schedutil.c +++ b/kernel/sched/cpufreq_schedutil.c @@ -10,6 +10,7 @@ #include "sched.h" +#include #include #include @@ -201,9 +202,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.22.0