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: 10109605 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 426E060327 for ; Wed, 13 Dec 2017 09:54:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3969E28FE7 for ; Wed, 13 Dec 2017 09:54:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2DEAE291E8; Wed, 13 Dec 2017 09:54:55 +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=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_HI autolearn=ham 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 A42F628FE7 for ; Wed, 13 Dec 2017 09:54:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751479AbdLMJyu (ORCPT ); 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-Google-Smtp-Source: ACJfBosBUY2p7mF0mCKXiHadTyOQaXYZ41wlh6ju8I9CES1uVCsmgS4iOYiIqjA8//3v5d1/VA3V6Q== 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 X-Virus-Scanned: ClamAV using ClamSMTP 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 Reviewed-by: Joel Fernandes --- kernel/sched/cpufreq_schedutil.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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;