From patchwork Thu Mar 2 08:33:21 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 9599691 X-Patchwork-Delegate: rjw@sisk.pl Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 9A4AF60414 for ; Thu, 2 Mar 2017 08:35:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9869728540 for ; Thu, 2 Mar 2017 08:35:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 89AB028552; Thu, 2 Mar 2017 08:35:33 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_HI,RCVD_IN_SORBS_SPAM autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 065F22846A for ; Thu, 2 Mar 2017 08:35:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754223AbdCBIeh (ORCPT ); Thu, 2 Mar 2017 03:34:37 -0500 Received: from mail-pg0-f41.google.com ([74.125.83.41]:32881 "EHLO mail-pg0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751274AbdCBIef (ORCPT ); Thu, 2 Mar 2017 03:34:35 -0500 Received: by mail-pg0-f41.google.com with SMTP id 25so30018245pgy.0 for ; Thu, 02 Mar 2017 00:33:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=VkZ7tvwzTEsvN+cxs2rYEm2aAkVRTgbmVVO9FcMpuYA=; b=KWeNYbMfqjmjbd4PtrS3AOoPykEwAJJXucPV0G4nqHLqCrg1fsDApq3pG2D5t3Uw0y yW5r/PGyiFCvCMO/m/YjmWD3Bi8BkW+V+7c4wVGf1/VmsbxN2k3XsjqGQSimPvGNflM4 Fy1vvLsyfpqQgjxM/7pCAhplvp9RmBCagadxs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=VkZ7tvwzTEsvN+cxs2rYEm2aAkVRTgbmVVO9FcMpuYA=; b=t+4h+AWpFX1GCMKYOdEJYlFQwKDqB9FXzWBc1a9AUBkmiLsMosWDmCddz7AtaPgG58 rkkWNmr8L5p3XuLeix+ORc9qqpvbEzwmDz5rh2nxByRvm9kcOR2DkaxjIAUa9dBeWdqy oQADDOCYMgYHNqYDoASMzAmA3XlufDq5Sh8lqXMTo7AYWHRjMfxv7rnjU2et26y+/XXk UM1JcmlhjGGZFyghnM1zXuR5gpKKiORdAdOyjY96hiu90oAreH5H8nyX241AZp5nqGjy RagU/LnkQOIC9wMLzk0UROGvAkgR7rTZNpr6cCRTLenXUAwwQOXKyWB52kQYCOr+HClc 4QWg== X-Gm-Message-State: AMke39miH98lHcJWsvtSLfDNeiPg0DKz87Ogb4UEEkjPaO/AYrVbbyQYaGTG0JS3f4pmeFQs X-Received: by 10.98.36.138 with SMTP id k10mr14108825pfk.53.1488443616960; Thu, 02 Mar 2017 00:33:36 -0800 (PST) Received: from localhost ([122.172.165.189]) by smtp.gmail.com with ESMTPSA id u75sm15317879pgc.31.2017.03.02.00.33.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 02 Mar 2017 00:33:36 -0800 (PST) From: Viresh Kumar To: Rafael Wysocki , Ingo Molnar , Peter Zijlstra Cc: linaro-kernel@lists.linaro.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Vincent Guittot , Viresh Kumar Subject: [PATCH 2/3] cpufreq: schedutil: Pass sg_policy to get_next_freq() Date: Thu, 2 Mar 2017 14:03:21 +0530 Message-Id: <7558e39af874a470fcfc3e64d0d1d93ec1ce009e.1488437503.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.7.1.410.g6faf27b In-Reply-To: References: In-Reply-To: References: Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP get_next_freq() uses sg_cpu only to get sg_policy, which the callers of get_next_freq() already have. Pass sg_policy instead of sg_cpu to get_next_freq(), to make it more efficient. Signed-off-by: Viresh Kumar --- kernel/sched/cpufreq_schedutil.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/kernel/sched/cpufreq_schedutil.c b/kernel/sched/cpufreq_schedutil.c index 721f4e011366..570925ea7253 100644 --- a/kernel/sched/cpufreq_schedutil.c +++ b/kernel/sched/cpufreq_schedutil.c @@ -115,7 +115,7 @@ static void sugov_update_commit(struct sugov_policy *sg_policy, u64 time, /** * get_next_freq - Compute a new frequency for a given cpufreq policy. - * @sg_cpu: schedutil cpu object to compute the new frequency for. + * @sg_policy: schedutil policy object to compute the new frequency for. * @util: Current CPU utilization. * @max: CPU capacity. * @@ -135,10 +135,9 @@ static void sugov_update_commit(struct sugov_policy *sg_policy, u64 time, * next_freq (as calculated above) is returned, subject to policy min/max and * cpufreq driver limitations. */ -static unsigned int get_next_freq(struct sugov_cpu *sg_cpu, unsigned long util, - unsigned long max) +static unsigned int get_next_freq(struct sugov_policy *sg_policy, + unsigned long util, unsigned long max) { - struct sugov_policy *sg_policy = sg_cpu->sg_policy; struct cpufreq_policy *policy = sg_policy->policy; unsigned int freq = arch_scale_freq_invariant() ? policy->cpuinfo.max_freq : policy->cur; @@ -212,7 +211,7 @@ static void sugov_update_single(struct update_util_data *hook, u64 time, } else { sugov_get_util(&util, &max); sugov_iowait_boost(sg_cpu, &util, &max); - next_f = get_next_freq(sg_cpu, util, max); + next_f = get_next_freq(sg_policy, util, max); } sugov_update_commit(sg_policy, time, next_f); } @@ -266,7 +265,7 @@ static unsigned int sugov_next_freq_shared(struct sugov_cpu *sg_cpu, sugov_iowait_boost(j_sg_cpu, &util, &max); } - return get_next_freq(sg_cpu, util, max); + return get_next_freq(sg_policy, util, max); } static void sugov_update_shared(struct update_util_data *hook, u64 time,