]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
sched: retain vruntime
authorPeter Zijlstra <a.p.zijlstra@chello.nl>
Fri, 29 Feb 2008 20:21:01 +0000 (15:21 -0500)
committerIngo Molnar <mingo@elte.hu>
Fri, 7 Mar 2008 15:42:59 +0000 (16:42 +0100)
Kei Tokunaga reported an interactivity problem when moving tasks
between control groups.

Tasks would retain their old vruntime when moved between groups, this
can cause funny lags. Re-set the vruntime on group move to fit within
the new tree.

Reported-by: Kei Tokunaga <tokunaga.keiich@jp.fujitsu.com>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
include/linux/sched.h
kernel/sched.c
kernel/sched_fair.c

index 9ae4030067a934b23293a72fe975ab72eda19d72..11d8e9a74effd57af24a7f8143b093da6d34f486 100644 (file)
@@ -899,6 +899,10 @@ struct sched_class {
                             int running);
        void (*prio_changed) (struct rq *this_rq, struct task_struct *task,
                             int oldprio, int running);
+
+#ifdef CONFIG_FAIR_GROUP_SCHED
+       void (*moved_group) (struct task_struct *p);
+#endif
 };
 
 struct load_weight {
index dcd553cc4ee89b52ec511f70361c4f7fd586d976..0b949c4e73ad2baa6d007332cf9c5b0e48c4c445 100644 (file)
@@ -7625,6 +7625,11 @@ void sched_move_task(struct task_struct *tsk)
 
        set_task_rq(tsk, task_cpu(tsk));
 
+#ifdef CONFIG_FAIR_GROUP_SCHED
+       if (tsk->sched_class->moved_group)
+               tsk->sched_class->moved_group(tsk);
+#endif
+
        if (on_rq) {
                if (unlikely(running))
                        tsk->sched_class->set_curr_task(rq);
index 3df4d46994ca80ddc861ba44fe8f7ac24b3c50ed..e2a530515619ee8f3b42b1ca246cd18ae05f5544 100644 (file)
@@ -1353,6 +1353,16 @@ static void set_curr_task_fair(struct rq *rq)
                set_next_entity(cfs_rq_of(se), se);
 }
 
+#ifdef CONFIG_FAIR_GROUP_SCHED
+static void moved_group_fair(struct task_struct *p)
+{
+       struct cfs_rq *cfs_rq = task_cfs_rq(p);
+
+       update_curr(cfs_rq);
+       place_entity(cfs_rq, &p->se, 1);
+}
+#endif
+
 /*
  * All the scheduling class methods:
  */
@@ -1381,6 +1391,10 @@ static const struct sched_class fair_sched_class = {
 
        .prio_changed           = prio_changed_fair,
        .switched_to            = switched_to_fair,
+
+#ifdef CONFIG_FAIR_GROUP_SCHED
+       .moved_group            = moved_group_fair,
+#endif
 };
 
 #ifdef CONFIG_SCHED_DEBUG