From patchwork Thu Mar 9 11:45:15 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 9613153 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 D90CC604D9 for ; Thu, 9 Mar 2017 11:45:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B93F1285C2 for ; Thu, 9 Mar 2017 11:45:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id ADB4C285F9; Thu, 9 Mar 2017 11:45:59 +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 49AA3285C2 for ; Thu, 9 Mar 2017 11:45:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932256AbdCILp5 (ORCPT ); Thu, 9 Mar 2017 06:45:57 -0500 Received: from mail-pg0-f51.google.com ([74.125.83.51]:36390 "EHLO mail-pg0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932217AbdCILp4 (ORCPT ); Thu, 9 Mar 2017 06:45:56 -0500 Received: by mail-pg0-f51.google.com with SMTP id g2so8331730pge.3 for ; Thu, 09 Mar 2017 03:45:55 -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=UbyNVwd+Z7X+ocUCTxvMP0FDiq/RwfawYbAXol3Y5CI=; b=Piwp9oKZ3CJy+/WOJMM8yTyA4Qf1/7cB0O+qLd8T+4GuFr8lnSrZhFazHVUrAdIK65 HXmgOI6RyuWKRYRmbEFlS/fwaxd9k7HejFs2zOMwTsN5a3HSO7Ms2JC6qgNVHEf2mRah QrysC3hYtToXqG7DyOfgRIXPE0UZe1KH50LrA= 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=UbyNVwd+Z7X+ocUCTxvMP0FDiq/RwfawYbAXol3Y5CI=; b=U+yC2JbSlmah8aJ0BZ8jBKECJTUcFj4t2Z7vOSbQdNE0TF2R/45rKTjeYy1L7KOADU peJuXrk72xS0Bsk1zFKzsLtzlc3KbwKaWn4vADBzJlIF8ymqk6r3DLX65R0ArzAgJkUE CCm2IsEx9BPGyHy3/Lz6I29ReHQg1kvQ6OYP3aJxRFOKpOk+vq6kdujoFaUin8fzp7tz k6XQ4LGyCfhzI8r98R2NggYWcDcfiHcn6T+/irOwoUM60heXziObPq0YPfI+X5Cs6BlM nW4xMtERTqCbVjXf8L2AysUGbBWDm7yaSnPnLmP/SuxetYDYXGRRWWxLNC2Fa17XxVW4 UwsA== X-Gm-Message-State: AMke39mjjaRW182ZSOAvoafN0hBhFwK5lIpTZzYG4zehU1tIruRjqjtm6p7hO5y2HpDfTFw3 X-Received: by 10.84.174.131 with SMTP id r3mr16592943plb.30.1489059954790; Thu, 09 Mar 2017 03:45:54 -0800 (PST) Received: from localhost ([122.171.239.200]) by smtp.gmail.com with ESMTPSA id 78sm12051482pfm.122.2017.03.09.03.45.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 09 Mar 2017 03:45:54 -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 , smuckle.linux@gmail.com, juri.lelli@arm.com, Morten.Rasmussen@arm.com, patrick.bellasi@arm.com, eas-dev@lists.linaro.org, Viresh Kumar Subject: [RFC 5/9] sched: cpufreq: remove smp_processor_id() in remote paths Date: Thu, 9 Mar 2017 17:15:15 +0530 Message-Id: <834d098efe029ee687bac7690bb482e9263a766b.1489058244.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 X-Virus-Scanned: ClamAV using ClamSMTP From: Steve Muckle Upcoming support for remote callbacks from the scheduler into schedutil requires that the CPU identified in the hook structure be used to indicate the CPU being operated on, rather than relying on smp_processor_id(). Note that policy->cpu is passed to trace_cpu_frequency() in fast switch path, as it is safe to use any CPU which is managed by the current policy. Signed-off-by: Steve Muckle [ vk: updated commit log, minor code cleanups and use policy->cpu for traces ] Signed-off-by: Viresh Kumar --- kernel/sched/cpufreq_schedutil.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/kernel/sched/cpufreq_schedutil.c b/kernel/sched/cpufreq_schedutil.c index a418544c51b1..b168c31f1c8f 100644 --- a/kernel/sched/cpufreq_schedutil.c +++ b/kernel/sched/cpufreq_schedutil.c @@ -96,7 +96,7 @@ static void sugov_fast_switch(struct cpufreq_policy *policy, return; policy->cur = next_freq; - trace_cpu_frequency(next_freq, smp_processor_id()); + trace_cpu_frequency(next_freq, policy->cpu); } static void sugov_update_commit(struct sugov_policy *sg_policy, u64 time, @@ -106,7 +106,7 @@ static void sugov_update_commit(struct sugov_policy *sg_policy, u64 time, if (policy->fast_switch_enabled) { if (sg_policy->next_freq == next_freq) { - trace_cpu_frequency(policy->cur, smp_processor_id()); + trace_cpu_frequency(policy->cur, policy->cpu); return; } sg_policy->next_freq = next_freq; @@ -157,12 +157,12 @@ static unsigned int get_next_freq(struct sugov_policy *sg_policy, return cpufreq_driver_resolve_freq(policy, freq); } -static void sugov_get_util(unsigned long *util, unsigned long *max) +static void sugov_get_util(unsigned long *util, unsigned long *max, int cpu) { - struct rq *rq = this_rq(); + struct rq *rq = cpu_rq(cpu); unsigned long cfs_max; - cfs_max = arch_scale_cpu_capacity(NULL, smp_processor_id()); + cfs_max = arch_scale_cpu_capacity(NULL, cpu); *util = min(rq->cfs.avg.util_avg, cfs_max); *max = cfs_max; @@ -216,7 +216,7 @@ static void sugov_update_single(struct update_util_data *hook, u64 time, if (flags & SCHED_CPUFREQ_RT_DL) { next_f = policy->cpuinfo.max_freq; } else { - sugov_get_util(&util, &max); + sugov_get_util(&util, &max, hook->cpu); sugov_iowait_boost(sg_cpu, &util, &max); next_f = get_next_freq(sg_policy, util, max); } @@ -272,7 +272,7 @@ 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); + sugov_get_util(&util, &max, hook->cpu); raw_spin_lock(&sg_policy->update_lock);