Skip to content

Commit e0367b1

Browse files
Juri LelliClaudio Scordino
authored andcommitted
sched/deadline: Move CPU frequency selection triggering points
Since SCHED_DEADLINE doesn't track utilization signal (but reserves a fraction of CPU bandwidth to tasks admitted to the system), there is no point in evaluating frequency changes during each tick event. Move frequency selection triggering points to where running_bw changes. Co-authored-by: Claudio Scordino <[email protected]> Signed-off-by: Juri Lelli <[email protected]> Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Reviewed-by: Viresh Kumar <[email protected]> Cc: Linus Torvalds <[email protected]> Cc: Luca Abeni <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Rafael J . Wysocki <[email protected]> Cc: Thomas Gleixner <[email protected]> Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Ingo Molnar <[email protected]>
1 parent d4edd66 commit e0367b1

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

kernel/sched/deadline.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,8 @@ void add_running_bw(u64 dl_bw, struct dl_rq *dl_rq)
8686
dl_rq->running_bw += dl_bw;
8787
SCHED_WARN_ON(dl_rq->running_bw < old); /* overflow */
8888
SCHED_WARN_ON(dl_rq->running_bw > dl_rq->this_bw);
89+
/* kick cpufreq (see the comment in kernel/sched/sched.h). */
90+
cpufreq_update_util(rq_of_dl_rq(dl_rq), SCHED_CPUFREQ_DL);
8991
}
9092

9193
static inline
@@ -98,6 +100,8 @@ void sub_running_bw(u64 dl_bw, struct dl_rq *dl_rq)
98100
SCHED_WARN_ON(dl_rq->running_bw > old); /* underflow */
99101
if (dl_rq->running_bw > old)
100102
dl_rq->running_bw = 0;
103+
/* kick cpufreq (see the comment in kernel/sched/sched.h). */
104+
cpufreq_update_util(rq_of_dl_rq(dl_rq), SCHED_CPUFREQ_DL);
101105
}
102106

103107
static inline
@@ -1134,9 +1138,6 @@ static void update_curr_dl(struct rq *rq)
11341138
return;
11351139
}
11361140

1137-
/* kick cpufreq (see the comment in kernel/sched/sched.h). */
1138-
cpufreq_update_util(rq, SCHED_CPUFREQ_DL);
1139-
11401141
schedstat_set(curr->se.statistics.exec_max,
11411142
max(curr->se.statistics.exec_max, delta_exec));
11421143

kernel/sched/sched.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2055,14 +2055,14 @@ DECLARE_PER_CPU(struct update_util_data *, cpufreq_update_util_data);
20552055
* The way cpufreq is currently arranged requires it to evaluate the CPU
20562056
* performance state (frequency/voltage) on a regular basis to prevent it from
20572057
* being stuck in a completely inadequate performance level for too long.
2058-
* That is not guaranteed to happen if the updates are only triggered from CFS,
2059-
* though, because they may not be coming in if RT or deadline tasks are active
2060-
* all the time (or there are RT and DL tasks only).
2058+
* That is not guaranteed to happen if the updates are only triggered from CFS
2059+
* and DL, though, because they may not be coming in if only RT tasks are
2060+
* active all the time (or there are RT tasks only).
20612061
*
2062-
* As a workaround for that issue, this function is called by the RT and DL
2063-
* sched classes to trigger extra cpufreq updates to prevent it from stalling,
2062+
* As a workaround for that issue, this function is called periodically by the
2063+
* RT sched class to trigger extra cpufreq updates to prevent it from stalling,
20642064
* but that really is a band-aid. Going forward it should be replaced with
2065-
* solutions targeted more specifically at RT and DL tasks.
2065+
* solutions targeted more specifically at RT tasks.
20662066
*/
20672067
static inline void cpufreq_update_util(struct rq *rq, unsigned int flags)
20682068
{

0 commit comments

Comments
 (0)