From patchwork Thu Jun 29 05:26:33 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 106606 Delivered-To: patch@linaro.org Received: by 10.140.101.44 with SMTP id t41csp704118qge; Wed, 28 Jun 2017 22:28:21 -0700 (PDT) X-Received: by 10.84.229.78 with SMTP id d14mr15953551pln.212.1498714101357; Wed, 28 Jun 2017 22:28:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1498714101; cv=none; d=google.com; s=arc-20160816; b=YRZUCT3G286Z9dpBKym3l5/Oust+guk0g3wHUQWKmSJr9OBrqb89dyRTW6EM6MnyBb 0H7rlJEvsexbTNpppzyx9QG4vn4/e3rHl/A1/dVEWi4fToogbdrQbbmR/bI0FjrK1Vri f1QQ9b3giGHCFbtWC84rofmPm8EDo0qAKKt21ERD7r/Y0mYQTHb3LiuN/rymDb0rL/oe xyXAaHiXuUST2NiuepZwyB5GQTVnktMPJYRmcqzD/WOsf1xx3vZXrhKfr9E4ZoZh6//3 olrx/n182mEdZ9hd4w2K1zs4z5I9agzZMRUgZugFHbSLAmZqdfjimaBD/4svyLKXwU1D 4Epg== 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=A0nNk5CJZT0A65cDbVIUdDYWcvwjGJohbeF7QI8X0hw=; b=0T2okSxdB9fNqqzOT/rkLjgUfvACNoWJ+fjaN5ASdpWjj2IHGwWlHE/ATq2o/dVImo caq3g8edwuKBgtOmyFCcC7u05ln45rE94xDvAi0tK+8M9KH9OydlvywHNGRTdYE9z5R6 +gKQfjIfJO8WKTdkUvPF07fapKxer8vF0cAaaqRQ02ppJRuKHocwlk3wJDX2Pg38yBcQ vS6kTfW6IbUvEMClOU2Ps5AZi5MGCkyVfDVYF2D1sLB7yhmUsAt9onlG89JElhwVcDvI YGS2pKVKLseRIv27r2Ys0wvUZ39/sXnOo0eloFDPQpMJ0LDF10EuJt9n/2F/LAQr/R4U tajg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.b=cKrqeJMp; 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; 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 o132si2958973pfo.405.2017.06.28.22.28.21; Wed, 28 Jun 2017 22:28:21 -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; dkim=pass header.i=@linaro.org header.b=cKrqeJMp; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752094AbdF2F2T (ORCPT + 25 others); Thu, 29 Jun 2017 01:28:19 -0400 Received: from mail-pg0-f54.google.com ([74.125.83.54]:33042 "EHLO mail-pg0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751615AbdF2F2G (ORCPT ); Thu, 29 Jun 2017 01:28:06 -0400 Received: by mail-pg0-f54.google.com with SMTP id f127so42325699pgc.0 for ; Wed, 28 Jun 2017 22:28:05 -0700 (PDT) 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=A0nNk5CJZT0A65cDbVIUdDYWcvwjGJohbeF7QI8X0hw=; b=cKrqeJMpnMM3VhzxIA6vp2SKcbKjeikHnuJiixY+IviXj6Q3LPFU0ni6DluOAqW7tF 6hg1HFyPx2k7pEN8xu0tL6zlXXBzxNugmLr1k/y1AGf1NZigp/lQ7xoLYuGO2YxG1ySk YKIiiBTF2kyTvXOQPR5NaNd0qh7EfeNcxBuc4= 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=A0nNk5CJZT0A65cDbVIUdDYWcvwjGJohbeF7QI8X0hw=; b=rDo37+8i6WgtYlo4k/Z4hP3j2OoZlTErY4Gf119pEz9ph+1tWOmIrDAAH/Ol+olqfu ozBOCNQ+iFnm2GNLLh/7XYw/vWWRZrk1eUVRKlfkzw02DviBjf9RBApHemoVO+KCuAK+ pWf5G5IORxkNfQOFlPCtt8zuf8DcE6fZEUdaFyytQHPSgdm/UW+zv8XoRjEOlUkg6Ox1 n+IPaOAj5koafyNiCKQPwhoa6u2dMRY2+JZH86MSzY7N0y9xQaksFHHn7CbmREC6vOEu +34qQNYdVZ8v+wWmqutTENxt5PGNjsDBvZputZ0C8bxbT4GvkhrE+cMRJ0zNg0ryS6dT v6mQ== X-Gm-Message-State: AKS2vOyaj5jVA1x0OJSOSvQ+YyeMCZM/9keetxwXpLdgngySbVUZTeg5 sS/7bWEq1mOB5A/x X-Received: by 10.84.229.79 with SMTP id d15mr16204771pln.4.1498714085137; Wed, 28 Jun 2017 22:28:05 -0700 (PDT) Received: from localhost ([122.171.238.149]) by smtp.gmail.com with ESMTPSA id m196sm2297100pga.33.2017.06.28.22.28.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 28 Jun 2017 22:28:04 -0700 (PDT) From: Viresh Kumar To: Rafael Wysocki , Ingo Molnar , Peter Zijlstra Cc: Viresh Kumar , linux-pm@vger.kernel.org, Vincent Guittot , linux-kernel@vger.kernel.org, smuckle.linux@gmail.com, juri.lelli@arm.com, Morten.Rasmussen@arm.com, patrick.bellasi@arm.com, eas-dev@lists.linaro.org Subject: [PATCH V2 4/4] sched: cpufreq: Enable remote sched cpufreq callbacks Date: Thu, 29 Jun 2017 10:56:33 +0530 Message-Id: X-Mailer: git-send-email 2.13.0.71.gd7076ec9c9cb In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Now that all clients properly support (or ignore) remote scheduler cpufreq callbacks, remove the restriction that such callbacks only be made on the local CPU. Also remove cpufreq_update_this_cpu() as all its users are migrated to use cpufreq_update_util() instead. Based on initial work from Steve Muckle. Signed-off-by: Steve Muckle Signed-off-by: Viresh Kumar --- kernel/sched/deadline.c | 2 +- kernel/sched/fair.c | 8 +++++--- kernel/sched/rt.c | 2 +- kernel/sched/sched.h | 10 ++-------- 4 files changed, 9 insertions(+), 13 deletions(-) -- 2.13.0.71.gd7076ec9c9cb diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c index a2ce59015642..512d51226998 100644 --- a/kernel/sched/deadline.c +++ b/kernel/sched/deadline.c @@ -763,7 +763,7 @@ static void update_curr_dl(struct rq *rq) } /* kick cpufreq (see the comment in kernel/sched/sched.h). */ - cpufreq_update_this_cpu(rq, SCHED_CPUFREQ_DL); + cpufreq_update_util(rq, SCHED_CPUFREQ_DL); schedstat_set(curr->se.statistics.exec_max, max(curr->se.statistics.exec_max, delta_exec)); diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index c77e4b1d51c0..77ef663e1380 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -3215,7 +3215,9 @@ static inline void set_tg_cfs_propagate(struct cfs_rq *cfs_rq) {} static inline void cfs_rq_util_change(struct cfs_rq *cfs_rq) { - if (&this_rq()->cfs == cfs_rq) { + struct rq *rq = rq_of(cfs_rq); + + if (&rq->cfs == cfs_rq) { /* * There are a few boundary cases this might miss but it should * get called often enough that that should (hopefully) not be @@ -3232,7 +3234,7 @@ static inline void cfs_rq_util_change(struct cfs_rq *cfs_rq) * * See cpu_util(). */ - cpufreq_update_util(rq_of(cfs_rq), 0); + cpufreq_update_util(rq, 0); } } @@ -4792,7 +4794,7 @@ enqueue_task_fair(struct rq *rq, struct task_struct *p, int flags) * passed. */ if (p->in_iowait) - cpufreq_update_this_cpu(rq, SCHED_CPUFREQ_IOWAIT); + cpufreq_update_util(rq, SCHED_CPUFREQ_IOWAIT); for_each_sched_entity(se) { if (se->on_rq) diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c index 979b7341008a..1e626e49f7fc 100644 --- a/kernel/sched/rt.c +++ b/kernel/sched/rt.c @@ -959,7 +959,7 @@ static void update_curr_rt(struct rq *rq) return; /* Kick cpufreq (see the comment in kernel/sched/sched.h). */ - cpufreq_update_this_cpu(rq, SCHED_CPUFREQ_RT); + cpufreq_update_util(rq, SCHED_CPUFREQ_RT); schedstat_set(curr->se.statistics.exec_max, max(curr->se.statistics.exec_max, delta_exec)); diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h index 6dda2aab731e..cce497b5837c 100644 --- a/kernel/sched/sched.h +++ b/kernel/sched/sched.h @@ -1987,19 +1987,13 @@ static inline void cpufreq_update_util(struct rq *rq, unsigned int flags) { struct update_util_data *data; - data = rcu_dereference_sched(*this_cpu_ptr(&cpufreq_update_util_data)); + data = rcu_dereference_sched(*per_cpu_ptr(&cpufreq_update_util_data, + cpu_of(rq))); if (data) data->func(data, rq_clock(rq), flags); } - -static inline void cpufreq_update_this_cpu(struct rq *rq, unsigned int flags) -{ - if (cpu_of(rq) == smp_processor_id()) - cpufreq_update_util(rq, flags); -} #else static inline void cpufreq_update_util(struct rq *rq, unsigned int flags) {} -static inline void cpufreq_update_this_cpu(struct rq *rq, unsigned int flags) {} #endif /* CONFIG_CPU_FREQ */ #ifdef arch_scale_freq_capacity