Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1362236

[PATCH 2/2] sched/fair: do not call cpufreq hook unless util changed

From Steve Muckle <steve.muckle@linaro.org>
Newsgroups linux.kernel
Subject [PATCH 2/2] sched/fair: do not call cpufreq hook unless util changed
Date 2016-03-22 01:30 +0100
Message-ID <rfimR-4U6-11@gated-at.bofh.it> (permalink)
References <rfimR-4U6-13@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


There's no reason to call the cpufreq hook if the root cfs_rq
utilization has not been modified.

Signed-off-by: Steve Muckle <smuckle@linaro.org>
---
 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 d418deb04049..af58e826cffe 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -2826,20 +2826,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,
@@ -2850,7 +2851,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;
 
 		/*
@@ -2873,7 +2875,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 */
-- 
2.4.10

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[PATCH 2/2] sched/fair: do not call cpufreq hook unless util changed Steve Muckle <steve.muckle@linaro.org> - 2016-03-22 01:30 +0100
  Re: [PATCH 2/2] sched/fair: do not call cpufreq hook unless util  changed Sai Gurrappadi <sgurrappadi@nvidia.com> - 2016-03-25 00:50 +0100
    Re: [PATCH 2/2] sched/fair: do not call cpufreq hook unless util  changed Steve Muckle <steve.muckle@linaro.org> - 2016-03-25 02:10 +0100
      Re: [PATCH 2/2] sched/fair: do not call cpufreq hook unless util  changed Sai Gurrappadi <sgurrappadi@nvidia.com> - 2016-03-25 22:30 +0100

csiph-web