diff options
author | Paul Turner <pjt@google.com> | 2012-10-04 07:18:30 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2012-10-24 04:27:24 -0400 |
commit | c566e8e9e44b72b53091da20e2dedefc730f2ee2 (patch) | |
tree | 3e86db8843021c36b41362063183d1135fda63db /kernel/sched/fair.c | |
parent | aff3e498844441fa71c5ee1bbc470e1dff9548d9 (diff) |
sched: Aggregate total task_group load
Maintain a global running sum of the average load seen on each cfs_rq belonging
to each task group so that it may be used in calculating an appropriate
shares:weight distribution.
Signed-off-by: Paul Turner <pjt@google.com>
Reviewed-by: Ben Segall <bsegall@google.com>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/20120823141506.792901086@google.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'kernel/sched/fair.c')
-rw-r--r-- | kernel/sched/fair.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 74dc29ba1ad1..db788222f198 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c | |||
@@ -1102,6 +1102,26 @@ static inline u64 __synchronize_entity_decay(struct sched_entity *se) | |||
1102 | return decays; | 1102 | return decays; |
1103 | } | 1103 | } |
1104 | 1104 | ||
1105 | #ifdef CONFIG_FAIR_GROUP_SCHED | ||
1106 | static inline void __update_cfs_rq_tg_load_contrib(struct cfs_rq *cfs_rq, | ||
1107 | int force_update) | ||
1108 | { | ||
1109 | struct task_group *tg = cfs_rq->tg; | ||
1110 | s64 tg_contrib; | ||
1111 | |||
1112 | tg_contrib = cfs_rq->runnable_load_avg + cfs_rq->blocked_load_avg; | ||
1113 | tg_contrib -= cfs_rq->tg_load_contrib; | ||
1114 | |||
1115 | if (force_update || abs64(tg_contrib) > cfs_rq->tg_load_contrib / 8) { | ||
1116 | atomic64_add(tg_contrib, &tg->load_avg); | ||
1117 | cfs_rq->tg_load_contrib += tg_contrib; | ||
1118 | } | ||
1119 | } | ||
1120 | #else | ||
1121 | static inline void __update_cfs_rq_tg_load_contrib(struct cfs_rq *cfs_rq, | ||
1122 | int force_update) {} | ||
1123 | #endif | ||
1124 | |||
1105 | /* Compute the current contribution to load_avg by se, return any delta */ | 1125 | /* Compute the current contribution to load_avg by se, return any delta */ |
1106 | static long __update_entity_load_avg_contrib(struct sched_entity *se) | 1126 | static long __update_entity_load_avg_contrib(struct sched_entity *se) |
1107 | { | 1127 | { |
@@ -1172,6 +1192,8 @@ static void update_cfs_rq_blocked_load(struct cfs_rq *cfs_rq, int force_update) | |||
1172 | atomic64_add(decays, &cfs_rq->decay_counter); | 1192 | atomic64_add(decays, &cfs_rq->decay_counter); |
1173 | cfs_rq->last_decay = now; | 1193 | cfs_rq->last_decay = now; |
1174 | } | 1194 | } |
1195 | |||
1196 | __update_cfs_rq_tg_load_contrib(cfs_rq, force_update); | ||
1175 | } | 1197 | } |
1176 | 1198 | ||
1177 | static inline void update_rq_runnable_avg(struct rq *rq, int runnable) | 1199 | static inline void update_rq_runnable_avg(struct rq *rq, int runnable) |