From patchwork Wed Dec 13 09:53:23 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 121728 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp5256767qgn; Wed, 13 Dec 2017 01:54:54 -0800 (PST) X-Google-Smtp-Source: ACJfBoubUr4Ynv38ubb/lXC3hTZcYAvEKsZZ3jLuG9749as14NLwICnIUcpGJJKjGL+t/ZYqFofW X-Received: by 10.84.229.5 with SMTP id b5mr5410649plk.405.1513158894633; Wed, 13 Dec 2017 01:54:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1513158894; cv=none; d=google.com; s=arc-20160816; b=r8C9fzrxkt5C8Ot6XPqt1UyShw1bhUZ+D8hw+iBRHZCNxD2AYRanl7QOp4m50E+g16 FI1x/dPVdrjMHkwKcupuzBunZwOy88Zze/JhNr3BlJ/urdEiuD40BjSb4/xemTFftiK1 IN5Csc15R8SDmt6j6SZtDu1dnQLxJvQG/WjomeFdbcI8p8xbB1qBgXBEkpS3Of0/WYAA Bt4eI9JS1kv3epCBZaYROPWCf0vMlxGSOC5bLNJFs+w6JE1GzG2vibF2RmNfqpoSJkUm Rdg+ej5g2gOUya7mkicoOSdke51hlDugLEuNlPJ2qQvmXiyxcwK3h1MYxdODQ4fXwSTa fhbg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=MNyW4kgQ5pnS086d9WcWZVi8B/+mwgi5ZXFkwUOIQH8=; b=V29tD16oT0rQCoSZSp7XoAr3N5O5FvECfoZiVwxPFdrdwIMwkVOvrJm6CzbsWJJQEI AYjyUk14LHZljFTuMJxINcXWplI3dKEOCjq29htexXUMiYTl8s7NIhAur/bT+aZZH0nZ RqQ59ToMbyDWB8akknX8bNE9qBGH/b+EKGleTBc2qy0hTURziKiRBHKXsng2mfJGAmOP gslIJxsuIHJuP7tAX3kwUaIWlGoK0Bc69nfR8gEDh0qbi6pCRl3+JA0Z9dY7L7dp/dhe jJenIyUYwEJdR+dOYc+0mQ30BvQ7Uq4IiccNC9tPBEJ/tIY3skIBuymiJ2j2za5aT1Qo 6m5w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=OIQ8jZtL; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c20si1140380pfd.107.2017.12.13.01.54.54; Wed, 13 Dec 2017 01:54:54 -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 header.s=google header.b=OIQ8jZtL; 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 S1751479AbdLMJyu (ORCPT + 11 others); Wed, 13 Dec 2017 04:54:50 -0500 Received: from mail-pl0-f66.google.com ([209.85.160.66]:43640 "EHLO mail-pl0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752638AbdLMJxk (ORCPT ); Wed, 13 Dec 2017 04:53:40 -0500 Received: by mail-pl0-f66.google.com with SMTP id z5so697885plo.10 for ; Wed, 13 Dec 2017 01:53: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=MNyW4kgQ5pnS086d9WcWZVi8B/+mwgi5ZXFkwUOIQH8=; b=OIQ8jZtLxlJ3y+daO852rb9fYtmrMFMUyUyOFG9ibWLV8HKeTOG1wPhqiZ7cuIJ3X1 6zSMKf4DdW8mDW3m+NLBSY+WhUB5k0ixlai1dGKHQDepD7CDVey51BVhINJHG+FzvYCm i2I2O5fLgs5SB4eD/j8T1ge/dKqIRiqX/C04k= 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=MNyW4kgQ5pnS086d9WcWZVi8B/+mwgi5ZXFkwUOIQH8=; b=GrrQgUkdqynYCQKOP3dpCQWx8dg1BalJdQ1X3EETyzpDQbTR49EYu51yPMd0+/ByDq 6sVtPWmMS9L0wp6REsA/I7Xqh6vuG1efpw64wYZg9HV9z/UOkFUiKuKNyDBFf5Y1Iql3 PPduwhu02kSZnVWCTc0FtRHNUXuc/2HyawHM86TMqNIIQINrunvzMSLItvdpFF3lCzFE /kGlwhhRxoveyJGKR8fxrHPHjRm5UWUiY9VwRL4cfuYoI7kDF85SE/JF72vPhKmPlmgF VCnVaslZWXURW55PgjGAZFCMbFDZK/BPj52PdpJYi5kvXJBxTs+jtmLhPA9l0EP0EgOg byYA== X-Gm-Message-State: AKGB3mJJRX6QLh1VUaWpVd5jle9eAO2TQnZ6JC41jdtSqNUmak/8rHI2 ucVvsN/ujXZFgYL2L97x3kTaag== X-Received: by 10.159.231.22 with SMTP id w22mr5443147plq.167.1513158819860; Wed, 13 Dec 2017 01:53:39 -0800 (PST) Received: from localhost ([122.172.99.7]) by smtp.gmail.com with ESMTPSA id m9sm2581358pff.3.2017.12.13.01.53.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 13 Dec 2017 01:53:39 -0800 (PST) From: Viresh Kumar To: Rafael Wysocki , Ingo Molnar , Peter Zijlstra Cc: Viresh Kumar , linux-pm@vger.kernel.org, Vincent Guittot , dietmar.eggemann@arm.com, morten.rasmussen@arm.com, juri.lelli@redhat.com, tkjos@android.com, joelaf@google.com, linux-kernel@vger.kernel.org Subject: [PATCH 4/4] cpufreq: schedutil: Don't call sugov_get_util() unnecessarily Date: Wed, 13 Dec 2017 15:23:23 +0530 Message-Id: <7b0698a61bcb959704f58dbabe8c70d657210301.1513158452.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.15.0.194.g9af6a3dea062 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 sugov_update_shared() may get called to clear the scheduling class flags and we would return immediately in that case. Calling sugov_get_util() in that case isn't going to be of any use then. Move invocation of sugov_get_util() after the clear flag is checked. Signed-off-by: Viresh Kumar --- kernel/sched/cpufreq_schedutil.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- 2.15.0.194.g9af6a3dea062 Reviewed-by: Joel Fernandes diff --git a/kernel/sched/cpufreq_schedutil.c b/kernel/sched/cpufreq_schedutil.c index 7edfdc59ee8f..b69c37c867fe 100644 --- a/kernel/sched/cpufreq_schedutil.c +++ b/kernel/sched/cpufreq_schedutil.c @@ -349,8 +349,6 @@ static void sugov_update_shared(struct update_util_data *hook, u64 time, unsigned long util, max; unsigned int next_f; - sugov_get_util(&util, &max, sg_cpu->cpu); - raw_spin_lock(&sg_policy->update_lock); if (unlikely(flags & SCHED_CPUFREQ_CLEAR)) { @@ -358,6 +356,8 @@ static void sugov_update_shared(struct update_util_data *hook, u64 time, goto unlock; } + sugov_get_util(&util, &max, sg_cpu->cpu); + sg_cpu->util = util; sg_cpu->max = max; sg_cpu->flags |= flags;