linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] sched/cpufreq: don't trigger cpufreq update w/o real rt/deadline tasks running
@ 2016-04-18  5:51 Wanpeng Li
  2016-04-20  0:32 ` Rafael J. Wysocki
  0 siblings, 1 reply; 14+ messages in thread
From: Wanpeng Li @ 2016-04-18  5:51 UTC (permalink / raw)
  To: Ingo Molnar, Peter Zijlstra; +Cc: Rafael J. Wysocki, linux-kernel, Wanpeng Li

Sometimes update_curr() is called w/o tasks actually running, it is
captured by: 
	u64 delta_exec = rq_clock_task(rq) - curr->se.exec_start;
We should not trigger cpufreq update in this case for rt/deadline
classes, and this patch fix it.

Signed-off-by: Wanpeng Li <wanpeng.li@hotmail.com>
---
 kernel/sched/deadline.c | 8 ++++----
 kernel/sched/rt.c       | 8 ++++----
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
index affd97e..8f9b5af 100644
--- a/kernel/sched/deadline.c
+++ b/kernel/sched/deadline.c
@@ -717,10 +717,6 @@ static void update_curr_dl(struct rq *rq)
 	if (!dl_task(curr) || !on_dl_rq(dl_se))
 		return;
 
-	/* Kick cpufreq (see the comment in linux/cpufreq.h). */
-	if (cpu_of(rq) == smp_processor_id())
-		cpufreq_trigger_update(rq_clock(rq));
-
 	/*
 	 * Consumed budget is computed considering the time as
 	 * observed by schedulable tasks (excluding time spent
@@ -736,6 +732,10 @@ static void update_curr_dl(struct rq *rq)
 		return;
 	}
 
+	/* kick cpufreq (see the comment in linux/cpufreq.h). */
+	if (cpu_of(rq) == smp_processor_id())
+		cpufreq_trigger_update(rq_clock(rq));
+
 	schedstat_set(curr->se.statistics.exec_max,
 		      max(curr->se.statistics.exec_max, delta_exec));
 
diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c
index c41ea7a..19e1306 100644
--- a/kernel/sched/rt.c
+++ b/kernel/sched/rt.c
@@ -953,14 +953,14 @@ static void update_curr_rt(struct rq *rq)
 	if (curr->sched_class != &rt_sched_class)
 		return;
 
-	/* Kick cpufreq (see the comment in linux/cpufreq.h). */
-	if (cpu_of(rq) == smp_processor_id())
-		cpufreq_trigger_update(rq_clock(rq));
-
 	delta_exec = rq_clock_task(rq) - curr->se.exec_start;
 	if (unlikely((s64)delta_exec <= 0))
 		return;
 
+	/* Kick cpufreq (see the comment in linux/cpufreq.h). */
+	if (cpu_of(rq) == smp_processor_id())
+		cpufreq_trigger_update(rq_clock(rq));
+
 	schedstat_set(curr->se.statistics.exec_max,
 		      max(curr->se.statistics.exec_max, delta_exec));
 
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2016-04-21 17:17 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-18  5:51 [PATCH] sched/cpufreq: don't trigger cpufreq update w/o real rt/deadline tasks running Wanpeng Li
2016-04-20  0:32 ` Rafael J. Wysocki
2016-04-20  0:48   ` Wanpeng Li
2016-04-20 14:01   ` Peter Zijlstra
2016-04-20 22:24     ` Wanpeng Li
2016-04-20 22:28       ` Rafael J. Wysocki
2016-04-21  1:09         ` Wanpeng Li
2016-04-21 11:11           ` Rafael J. Wysocki
2016-04-21 12:12             ` Wanpeng Li
2016-04-21 12:25               ` Wanpeng Li
2016-04-21 12:33           ` Peter Zijlstra
2016-04-21 13:33             ` Wanpeng Li
2016-04-21 17:07             ` Rafael J. Wysocki
2016-04-21 17:17               ` Peter Zijlstra

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).