From: Peter Zijlstra <a.p.zijlstra@chello.nl>
Date: Fri, 9 Nov 2007 21:39:37 +0000 (+0100)
Subject: sched: documentation: place_entity() comments
X-Git-Tag: v2.6.24-rc3~170^2~16
X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=2cb8600e6be4281e381d39e44de4359e46333e23;p=linux-2.6-omap-h63xx.git

sched: documentation: place_entity() comments

Add a few comments to place_entity(). No code changed.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---

diff --git a/kernel/sched_fair.c b/kernel/sched_fair.c
index 62b057603f0..8763bee6b66 100644
--- a/kernel/sched_fair.c
+++ b/kernel/sched_fair.c
@@ -473,19 +473,26 @@ place_entity(struct cfs_rq *cfs_rq, struct sched_entity *se, int initial)
 	} else if (sched_feat(APPROX_AVG) && cfs_rq->nr_running)
 		vruntime += sched_vslice(cfs_rq)/2;
 
+	/*
+	 * The 'current' period is already promised to the current tasks,
+	 * however the extra weight of the new task will slow them down a
+	 * little, place the new task so that it fits in the slot that
+	 * stays open at the end.
+	 */
 	if (initial && sched_feat(START_DEBIT))
 		vruntime += sched_vslice_add(cfs_rq, se);
 
 	if (!initial) {
+		/* sleeps upto a single latency don't count. */
 		if (sched_feat(NEW_FAIR_SLEEPERS) && entity_is_task(se) &&
 				task_of(se)->policy != SCHED_BATCH)
 			vruntime -= sysctl_sched_latency;
 
-		vruntime = max_t(s64, vruntime, se->vruntime);
+		/* ensure we never gain time by being placed backwards. */
+		vruntime = max_vruntime(se->vruntime, vruntime);
 	}
 
 	se->vruntime = vruntime;
-
 }
 
 static void