Skip to content

Commit 1a99ae3

Browse files
Xunlei PangIngo Molnar
authored andcommitted
sched/fair: Fix the wrong throttled clock time for cfs_rq_clock_task()
Two minor fixes for cfs_rq_clock_task(): 1) If cfs_rq is currently being throttled, we need to subtract the cfs throttled clock time. 2) Make "throttled_clock_task_time" update SMP unrelated. Now UP cases need it as well. Signed-off-by: Xunlei Pang <[email protected]> Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Cc: Juri Lelli <[email protected]> Cc: Linus Torvalds <[email protected]> Cc: Mike Galbraith <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Steven Rostedt <[email protected]> Cc: Thomas Gleixner <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Ingo Molnar <[email protected]>
1 parent 719af93 commit 1a99ae3

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

kernel/sched/fair.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3688,7 +3688,7 @@ static inline struct cfs_bandwidth *tg_cfs_bandwidth(struct task_group *tg)
36883688
static inline u64 cfs_rq_clock_task(struct cfs_rq *cfs_rq)
36893689
{
36903690
if (unlikely(cfs_rq->throttle_count))
3691-
return cfs_rq->throttled_clock_task;
3691+
return cfs_rq->throttled_clock_task - cfs_rq->throttled_clock_task_time;
36923692

36933693
return rq_clock_task(rq_of(cfs_rq)) - cfs_rq->throttled_clock_task_time;
36943694
}
@@ -3826,13 +3826,11 @@ static int tg_unthrottle_up(struct task_group *tg, void *data)
38263826
struct cfs_rq *cfs_rq = tg->cfs_rq[cpu_of(rq)];
38273827

38283828
cfs_rq->throttle_count--;
3829-
#ifdef CONFIG_SMP
38303829
if (!cfs_rq->throttle_count) {
38313830
/* adjust cfs_rq_clock_task() */
38323831
cfs_rq->throttled_clock_task_time += rq_clock_task(rq) -
38333832
cfs_rq->throttled_clock_task;
38343833
}
3835-
#endif
38363834

38373835
return 0;
38383836
}

0 commit comments

Comments
 (0)