From patchwork Thu Nov 2 10:54:38 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Redpath X-Patchwork-Id: 117770 Delivered-To: patch@linaro.org Received: by 10.80.245.45 with SMTP id t42csp1904371edm; Thu, 2 Nov 2017 03:56:37 -0700 (PDT) X-Google-Smtp-Source: ABhQp+Tw7mevI63M4LCUAfNzkScGFWtUYGXVh8OaGssuGdJDVuXC1a0Qosej3tJKRg8R1pEdMZQK X-Received: by 10.159.255.5 with SMTP id bi5mr2104199plb.217.1509620197814; Thu, 02 Nov 2017 03:56:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1509620197; cv=none; d=google.com; s=arc-20160816; b=p4kNvtTgZCpAe6bKaX2F65gM/3x88UHaCX6T7dInCJcyVeKjdPJPIqgXebD0jkeDTl Z76BPRRQjNBH0RPVR3RmPI9b8f9Z3ZvqiMnnNvm3nH+B2EL3gh73ITeNHf1nQTrBWo88 rmFqhEc9DFdNTSm6qWJ8oAEU8ZBY58pPjZRTkExLMZkvkDYrSyeOrizT8XIdvcrEWAYp r5YaC7SCLb5dO2kjhZp0XdxAHhzJ5KEwI4B+sdNU3ZbibTPmhSdshDI0UP71i57PJLAo CNdn4ZkSh2oroQWlULAJoePEGE17Tv/XQ2GNILtV0bWV+f6nwl8JKmv9aVRNZHtp8nCR Z6IQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=FcCBxVKv8evehirHRHx8xZ+UsaT2XOGNGPlHN95Jqog=; b=l3eEjxPo9B/N2gA5RaTh1dUzObQTxnI03SzwXCT9uEXMJIAvjmI6I01vhABH4be7+1 XCrXtNC7gNhpOuBDnRLdEckdedIpMOdAkTWyTG6V5FIoYKmwARAxPUOi2OQR1JzsRDwX bmB2Zob+pzIiFECE3AGQPO4qd+UHwoiciTIJ9J7HZNAflNDsO5H4foBKeyDqBSA9WqSt sGE1iQcCzmDu94XBpqRqjMdO2tqsqoL9TbRRaYkaSkpg7zxHCs4ZfGbkWvPrBwgPioVu 9UQtNDUEwtu9Rp73rTjuYUPChOTC2NIQQBsvpC3PSVXy9C/MY+Ycb6QHgp9TtZnEi+MO tDPA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a33si1853551pld.662.2017.11.02.03.56.37; Thu, 02 Nov 2017 03:56:37 -0700 (PDT) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755701AbdKBK4f (ORCPT + 26 others); Thu, 2 Nov 2017 06:56:35 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:57924 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755529AbdKBKy5 (ORCPT ); Thu, 2 Nov 2017 06:54:57 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 95C3D1435; Thu, 2 Nov 2017 03:54:57 -0700 (PDT) Received: from e108031-lin.cambridge.arm.com (e108031-lin.cambridge.arm.com [10.1.211.46]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id C9BFD3F3E1; Thu, 2 Nov 2017 03:54:55 -0700 (PDT) From: Chris Redpath To: linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org Cc: morten.rasmussen@arm.com, dietmar.eggemann@arm.com, Chris Redpath , "Rafael J . Wysocki" , Viresh Kumar , Ingo Molnar , Peter Zijlstra , "4 . 9+" Subject: [PATCH] cpufreq: schedutil: Examine the correct CPU when we update util Date: Thu, 2 Nov 2017 10:54:38 +0000 Message-Id: <20171102105438.14258-1-chris.redpath@arm.com> X-Mailer: git-send-email 2.13.1.449.g02a2850 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Since: 4296f23ed cpufreq: schedutil: Fix per-CPU structure initialization in sugov_start() We lost the value of sg_cpu->cpu which is assigned during sugov_register. The memset in sugov_start overwrites it with zero. This leads to always looking at the utilization of CPU0 instead of the one we just updated when we do a utilization update callback. Let's fix this by consolidating the initialization code into sugov_start(). Fixes: 4296f23ed49a ("cpufreq: schedutil: Fix per-CPU structure initialization in sugov_start()") Signed-off-by: Chris Redpath Reviewed-by: Patrick Bellasi Reviewed-by: Brendan Jackman Cc: Rafael J. Wysocki Cc: Viresh Kumar Cc: Ingo Molnar Cc: Peter Zijlstra Cc: 4.9+ --- kernel/sched/cpufreq_schedutil.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) -- 2.13.1.449.g02a2850 diff --git a/kernel/sched/cpufreq_schedutil.c b/kernel/sched/cpufreq_schedutil.c index 6c1a7fcfa2a7..eeb7e0a1d861 100644 --- a/kernel/sched/cpufreq_schedutil.c +++ b/kernel/sched/cpufreq_schedutil.c @@ -731,6 +731,7 @@ static int sugov_start(struct cpufreq_policy *policy) sg_cpu->sg_policy = sg_policy; sg_cpu->flags = SCHED_CPUFREQ_RT; sg_cpu->iowait_boost_max = policy->cpuinfo.max_freq; + sg_cpu->cpu = cpu; } for_each_cpu(cpu, policy->cpus) { @@ -793,11 +794,6 @@ struct cpufreq_governor *cpufreq_default_governor(void) static int __init sugov_register(void) { - int cpu; - - for_each_possible_cpu(cpu) - per_cpu(sugov_cpu, cpu).cpu = cpu; - return cpufreq_register_governor(&schedutil_gov); } fs_initcall(sugov_register);