diff options
author | Peter Zijlstra <a.p.zijlstra@chello.nl> | 2007-10-15 11:00:12 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2007-10-15 11:00:12 -0400 |
commit | b0ffd246ea947a037746e725bd461bb7e809a4b3 (patch) | |
tree | 62ec34bb1fbb98be646084b74732ec9209e5f39f /kernel/sched_fair.c | |
parent | 2830cf8c90f37526d401f1999250312df970bfa3 (diff) |
sched: clean up min_vruntime use
clean up min_vruntime use.
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel/sched_fair.c')
-rw-r--r-- | kernel/sched_fair.c | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/kernel/sched_fair.c b/kernel/sched_fair.c index fcd6900849b3..ec0569e59e24 100644 --- a/kernel/sched_fair.c +++ b/kernel/sched_fair.c | |||
@@ -124,6 +124,16 @@ max_vruntime(u64 min_vruntime, u64 vruntime) | |||
124 | return min_vruntime; | 124 | return min_vruntime; |
125 | } | 125 | } |
126 | 126 | ||
127 | static inline u64 | ||
128 | min_vruntime(u64 min_vruntime, u64 vruntime) | ||
129 | { | ||
130 | s64 delta = (s64)(vruntime - min_vruntime); | ||
131 | if (delta < 0) | ||
132 | min_vruntime = vruntime; | ||
133 | |||
134 | return min_vruntime; | ||
135 | } | ||
136 | |||
127 | static inline s64 | 137 | static inline s64 |
128 | entity_key(struct cfs_rq *cfs_rq, struct sched_entity *se) | 138 | entity_key(struct cfs_rq *cfs_rq, struct sched_entity *se) |
129 | { | 139 | { |
@@ -251,7 +261,7 @@ __update_curr(struct cfs_rq *cfs_rq, struct sched_entity *curr, | |||
251 | unsigned long delta_exec) | 261 | unsigned long delta_exec) |
252 | { | 262 | { |
253 | unsigned long delta_exec_weighted; | 263 | unsigned long delta_exec_weighted; |
254 | u64 next_vruntime, min_vruntime; | 264 | u64 vruntime; |
255 | 265 | ||
256 | schedstat_set(curr->exec_max, max((u64)delta_exec, curr->exec_max)); | 266 | schedstat_set(curr->exec_max, max((u64)delta_exec, curr->exec_max)); |
257 | 267 | ||
@@ -269,19 +279,13 @@ __update_curr(struct cfs_rq *cfs_rq, struct sched_entity *curr, | |||
269 | * value tracking the leftmost vruntime in the tree. | 279 | * value tracking the leftmost vruntime in the tree. |
270 | */ | 280 | */ |
271 | if (first_fair(cfs_rq)) { | 281 | if (first_fair(cfs_rq)) { |
272 | next_vruntime = __pick_next_entity(cfs_rq)->vruntime; | 282 | vruntime = min_vruntime(curr->vruntime, |
273 | 283 | __pick_next_entity(cfs_rq)->vruntime); | |
274 | /* min_vruntime() := !max_vruntime() */ | ||
275 | min_vruntime = max_vruntime(curr->vruntime, next_vruntime); | ||
276 | if (min_vruntime == next_vruntime) | ||
277 | min_vruntime = curr->vruntime; | ||
278 | else | ||
279 | min_vruntime = next_vruntime; | ||
280 | } else | 284 | } else |
281 | min_vruntime = curr->vruntime; | 285 | vruntime = curr->vruntime; |
282 | 286 | ||
283 | cfs_rq->min_vruntime = | 287 | cfs_rq->min_vruntime = |
284 | max_vruntime(cfs_rq->min_vruntime, min_vruntime); | 288 | max_vruntime(cfs_rq->min_vruntime, vruntime); |
285 | } | 289 | } |
286 | 290 | ||
287 | static void update_curr(struct cfs_rq *cfs_rq) | 291 | static void update_curr(struct cfs_rq *cfs_rq) |