From patchwork Thu Mar 2 08:33:22 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 94763 Delivered-To: patch@linaro.org Received: by 10.140.82.71 with SMTP id g65csp61693qgd; Thu, 2 Mar 2017 00:35:56 -0800 (PST) X-Received: by 10.98.60.20 with SMTP id j20mr14329786pfa.128.1488443756295; Thu, 02 Mar 2017 00:35:56 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 123si6833327pgj.217.2017.03.02.00.35.56; Thu, 02 Mar 2017 00:35:56 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-pm-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-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-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 S1754482AbdCBIfv (ORCPT + 13 others); Thu, 2 Mar 2017 03:35:51 -0500 Received: from mail-pf0-f178.google.com ([209.85.192.178]:34284 "EHLO mail-pf0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754004AbdCBIef (ORCPT ); Thu, 2 Mar 2017 03:34:35 -0500 Received: by mail-pf0-f178.google.com with SMTP id e66so1568221pfe.1 for ; Thu, 02 Mar 2017 00:33:40 -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=K8JYOM9B4tWqM1N6+LwfKTsuBbFRzafW9mfbWQenpxQ=; b=CI3As44y6jTWhMfLlgkJfWPnRa+1EA5snv3/gvsApnBtAjZH1Swgvmm+y7mPwf9jeL PFm7GkL7bpY/2RYepM/PSuhqwmdDPpTffk4xpNqkmxi9WfvwclHp2fzE4Sgo7pHBRia4 zbxwpZxihhouCW8kadBPw0VD/agLY+kRmfdqE= 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=K8JYOM9B4tWqM1N6+LwfKTsuBbFRzafW9mfbWQenpxQ=; b=eRnRrgIuLDzDfyHNOLCi7OEVyAzZWMzQTPHMkAzTwDdXhPmihujDPcW9rwHMXghQ7a NzB/xz49wpGUzbDV+ZSS6aEaoC/0rCEXD+FfjbjGhdyrAAsUXTCmj4ZaNZPy8IMjOhPx L+tgRo1VwRLJRM8XoaeKz2kUE8pK0LGi1B32e6CuAMzjAhaaa/4Lhg6tQ078/jooWiRH vrdo79B+oiE4AMai0h/09Awz14UiUus1dakxfuaYHMe0lQKycA01JnBf4FsHpD2h5ELC sSRIKW6/mhC5evIT/Zwf+f/a0M4HY53sDn70DMnLfZXydpGuy/3nFvga2j4dCXq4pddT ++pg== X-Gm-Message-State: AMke39ngJmD9s8zvUM+IUZz6LLkBK/Bn4JapHLh1pvkPpi4LWrnwmHUn1O+JDMssBOJVeo8z X-Received: by 10.98.56.2 with SMTP id f2mr14262772pfa.130.1488443620099; Thu, 02 Mar 2017 00:33:40 -0800 (PST) Received: from localhost ([122.172.165.189]) by smtp.gmail.com with ESMTPSA id m3sm15237693pfc.66.2017.03.02.00.33.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 02 Mar 2017 00:33:39 -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 3/3] cpufreq: schedutil: remove redundant code from sugov_next_freq_shared() Date: Thu, 2 Mar 2017 14:03:22 +0530 Message-Id: <639aad743bac7f3292146738f44dbd1480169c8e.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 The same code is present both within and outside the loop and it doesn't look like it provides any additional benefit. Remove the special handling of sg_cpu and let it happen within the loop. With this change we will do two extra comparisons for the sg_cpu in the loop, but the loop will do one less comparison for every other CPU in the policy. While at it, also remove the excess parameters of sugov_next_freq_shared(). Signed-off-by: Viresh Kumar --- kernel/sched/cpufreq_schedutil.c | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) -- 2.7.1.410.g6faf27b diff --git a/kernel/sched/cpufreq_schedutil.c b/kernel/sched/cpufreq_schedutil.c index 570925ea7253..ec56537429a8 100644 --- a/kernel/sched/cpufreq_schedutil.c +++ b/kernel/sched/cpufreq_schedutil.c @@ -216,30 +216,20 @@ static void sugov_update_single(struct update_util_data *hook, u64 time, sugov_update_commit(sg_policy, time, next_f); } -static unsigned int sugov_next_freq_shared(struct sugov_cpu *sg_cpu, - unsigned long util, unsigned long max, - unsigned int flags) +static unsigned int sugov_next_freq_shared(struct sugov_cpu *sg_cpu) { struct sugov_policy *sg_policy = sg_cpu->sg_policy; struct cpufreq_policy *policy = sg_policy->policy; unsigned int max_f = policy->cpuinfo.max_freq; u64 last_freq_update_time = sg_policy->last_freq_update_time; + unsigned long util = 0, max = 1; unsigned int j; - if (flags & SCHED_CPUFREQ_RT_DL) - return max_f; - - sugov_iowait_boost(sg_cpu, &util, &max); - for_each_cpu(j, policy->cpus) { - struct sugov_cpu *j_sg_cpu; + struct sugov_cpu *j_sg_cpu = &per_cpu(sugov_cpu, j); unsigned long j_util, j_max; s64 delta_ns; - if (j == smp_processor_id()) - continue; - - j_sg_cpu = &per_cpu(sugov_cpu, j); /* * If the CPU utilization was last updated before the previous * frequency update and the time elapsed between the last update @@ -288,7 +278,7 @@ static void sugov_update_shared(struct update_util_data *hook, u64 time, sg_cpu->last_update = time; if (sugov_should_update_freq(sg_policy, time)) { - next_f = sugov_next_freq_shared(sg_cpu, util, max, flags); + next_f = sugov_next_freq_shared(sg_cpu); sugov_update_commit(sg_policy, time, next_f); }