diff options
author | Xunlei Pang <pang.xunlei@linaro.org> | 2014-12-16 10:58:29 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2015-01-14 07:34:13 -0500 |
commit | 638476007d13534b2ed4134bf0279ef44071140b (patch) | |
tree | aa8ee17a7fba6a4c80c66057b2e257568db8080e /kernel/sched | |
parent | 7f1a169b88f513e32a432ca0f85bfd282d117bd6 (diff) |
sched/fair: Fix the dealing with decay_count in __synchronize_entity_decay()
In __synchronize_entity_decay(), if "decays" happens to be zero,
se->avg.decay_count will not be zeroed, holding the positive value
assigned when dequeued last time.
This is problematic in the following case:
If this runnable task is CFS-balanced to other CPUs soon afterwards,
migrate_task_rq_fair() will treat it as a blocked task due to its
non-zero decay_count, thereby adding its load to cfs_rq->removed_load
wrongly.
Thus, we must zero se->avg.decay_count in this case as well.
Signed-off-by: Xunlei Pang <pang.xunlei@linaro.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Ben Segall <bsegall@google.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Link: http://lkml.kernel.org/r/1418745509-2609-1-git-send-email-pang.xunlei@linaro.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'kernel/sched')
-rw-r--r-- | kernel/sched/fair.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 40667cbf371b..97000a99a293 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c | |||
@@ -2574,11 +2574,11 @@ static inline u64 __synchronize_entity_decay(struct sched_entity *se) | |||
2574 | u64 decays = atomic64_read(&cfs_rq->decay_counter); | 2574 | u64 decays = atomic64_read(&cfs_rq->decay_counter); |
2575 | 2575 | ||
2576 | decays -= se->avg.decay_count; | 2576 | decays -= se->avg.decay_count; |
2577 | se->avg.decay_count = 0; | ||
2577 | if (!decays) | 2578 | if (!decays) |
2578 | return 0; | 2579 | return 0; |
2579 | 2580 | ||
2580 | se->avg.load_avg_contrib = decay_load(se->avg.load_avg_contrib, decays); | 2581 | se->avg.load_avg_contrib = decay_load(se->avg.load_avg_contrib, decays); |
2581 | se->avg.decay_count = 0; | ||
2582 | 2582 | ||
2583 | return decays; | 2583 | return decays; |
2584 | } | 2584 | } |