Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752269AbcDWM6m (ORCPT ); Sat, 23 Apr 2016 08:58:42 -0400 Received: from terminus.zytor.com ([198.137.202.10]:39440 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751836AbcDWM6l (ORCPT ); Sat, 23 Apr 2016 08:58:41 -0400 Date: Sat, 23 Apr 2016 05:57:58 -0700 From: tip-bot for Steve Muckle Message-ID: Cc: vincent.guittot@linaro.org, mingo@kernel.org, tglx@linutronix.de, Juri.Lelli@arm.com, peterz@infradead.org, mturquette@baylibre.com, efault@gmx.de, rafael@kernel.org, linux-kernel@vger.kernel.org, patrick.bellasi@arm.com, morten.rasmussen@arm.com, dietmar.eggemann@arm.com, smuckle@linaro.org, steve.muckle@linaro.org, hpa@zytor.com Reply-To: rafael@kernel.org, peterz@infradead.org, efault@gmx.de, mturquette@baylibre.com, tglx@linutronix.de, Juri.Lelli@arm.com, vincent.guittot@linaro.org, mingo@kernel.org, smuckle@linaro.org, steve.muckle@linaro.org, hpa@zytor.com, patrick.bellasi@arm.com, morten.rasmussen@arm.com, dietmar.eggemann@arm.com, linux-kernel@vger.kernel.org In-Reply-To: <1458606068-7476-2-git-send-email-smuckle@linaro.org> References: <1458606068-7476-2-git-send-email-smuckle@linaro.org> To: linux-tip-commits@vger.kernel.org Subject: [tip:sched/core] sched/fair: Do not call cpufreq hook unless util changed Git-Commit-ID: 41e0d37f7ac81297c07ba311e4ad39465b8c8295 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2849 Lines: 77 Commit-ID: 41e0d37f7ac81297c07ba311e4ad39465b8c8295 Gitweb: http://git.kernel.org/tip/41e0d37f7ac81297c07ba311e4ad39465b8c8295 Author: Steve Muckle AuthorDate: Mon, 21 Mar 2016 17:21:08 -0700 Committer: Ingo Molnar CommitDate: Sat, 23 Apr 2016 14:20:36 +0200 sched/fair: Do not call cpufreq hook unless util changed There's no reason to call the cpufreq hook if the root cfs_rq utilization has not been modified. Signed-off-by: Steve Muckle Signed-off-by: Peter Zijlstra (Intel) Cc: Dietmar Eggemann Cc: Juri Lelli Cc: Michael Turquette Cc: Mike Galbraith Cc: Morten Rasmussen Cc: Patrick Bellasi Cc: Peter Zijlstra Cc: Rafael J. Wysocki Cc: Thomas Gleixner Cc: Vincent Guittot Link: http://lkml.kernel.org/r/1458606068-7476-2-git-send-email-smuckle@linaro.org Signed-off-by: Ingo Molnar --- kernel/sched/fair.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 6df80d4..8155281 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -2879,20 +2879,21 @@ static inline int update_cfs_rq_load_avg(u64 now, struct cfs_rq *cfs_rq) { struct sched_avg *sa = &cfs_rq->avg; struct rq *rq = rq_of(cfs_rq); - int decayed, removed = 0; + int decayed, removed_load = 0, removed_util = 0; int cpu = cpu_of(rq); if (atomic_long_read(&cfs_rq->removed_load_avg)) { s64 r = atomic_long_xchg(&cfs_rq->removed_load_avg, 0); sa->load_avg = max_t(long, sa->load_avg - r, 0); sa->load_sum = max_t(s64, sa->load_sum - r * LOAD_AVG_MAX, 0); - removed = 1; + removed_load = 1; } if (atomic_long_read(&cfs_rq->removed_util_avg)) { long r = atomic_long_xchg(&cfs_rq->removed_util_avg, 0); sa->util_avg = max_t(long, sa->util_avg - r, 0); sa->util_sum = max_t(s32, sa->util_sum - r * LOAD_AVG_MAX, 0); + removed_util = 1; } decayed = __update_load_avg(now, cpu, sa, @@ -2903,7 +2904,8 @@ static inline int update_cfs_rq_load_avg(u64 now, struct cfs_rq *cfs_rq) cfs_rq->load_last_update_time_copy = sa->last_update_time; #endif - if (cpu == smp_processor_id() && &rq->cfs == cfs_rq) { + if (cpu == smp_processor_id() && &rq->cfs == cfs_rq && + (decayed || removed_util)) { unsigned long max = rq->cpu_capacity_orig; /* @@ -2926,7 +2928,7 @@ static inline int update_cfs_rq_load_avg(u64 now, struct cfs_rq *cfs_rq) min(sa->util_avg, max), max); } - return decayed || removed; + return decayed || removed_load; } /* Update task and its cfs_rq load average */