aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/sched_fair.c
diff options
context:
space:
mode:
authorPeter Zijlstra <a.p.zijlstra@chello.nl>2007-10-15 11:00:12 -0400
committerIngo Molnar <mingo@elte.hu>2007-10-15 11:00:12 -0400
commitb0ffd246ea947a037746e725bd461bb7e809a4b3 (patch)
tree62ec34bb1fbb98be646084b74732ec9209e5f39f /kernel/sched_fair.c
parent2830cf8c90f37526d401f1999250312df970bfa3 (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.c26
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
127static inline u64
128min_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
127static inline s64 137static inline s64
128entity_key(struct cfs_rq *cfs_rq, struct sched_entity *se) 138entity_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
287static void update_curr(struct cfs_rq *cfs_rq) 291static void update_curr(struct cfs_rq *cfs_rq)