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: 94762 Delivered-To: patch@linaro.org Received: by 10.140.82.71 with SMTP id g65csp61375qgd; Thu, 2 Mar 2017 00:34:47 -0800 (PST) X-Received: by 10.99.56.94 with SMTP id h30mr14086789pgn.23.1488443687832; Thu, 02 Mar 2017 00:34:47 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x185si6802421pgd.414.2017.03.02.00.34.47; Thu, 02 Mar 2017 00:34:47 -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; dkim=pass header.i=@linaro.org; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754261AbdCBIek (ORCPT + 25 others); Thu, 2 Mar 2017 03:34:40 -0500 Received: from mail-pg0-f44.google.com ([74.125.83.44]:34925 "EHLO mail-pg0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750771AbdCBIef (ORCPT ); Thu, 2 Mar 2017 03:34:35 -0500 Received: by mail-pg0-f44.google.com with SMTP id b129so29996570pgc.2 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=qCXVZNNAW7MxIP2phYfSJ/h2uF77Ikxuo/3RQlWrQo7dlbxegA+jRGtZ3DmIZIX2CZ iLiCmBtRKYO52CzMquYBycHlYa9Q3JPxqzcof9mPamjg7l+A4+kkgaDrbjHzXSNFJA9y AXKl2iqAODkbRLJZx21Y5b/yJ9h2vjDbRjrQQzkxeHhiK7hrMlrfUu7FczQ2T2DEAwVk L1IxanL3sd3kT1tapq5xNCti12re+HnFPJYC6/XQv6PFLl8OxJrWOwiEjbhQEWXh7Q6Q asm8cPlcz8vz2NhF0Ap/Azt3UeD9lMnA0SguvGVgBQPfm5tF82rCijWxP4x73k8Cofsj jFYQ== X-Gm-Message-State: AMke39kQmqydGH/rADPjBY4L3n2jYbumh4GFSAZa6jMg+gcOPMYrTI+AkJ9n+kBHcFPRd4IW 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-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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(-) -- 2.7.1.410.g6faf27b 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,