summaryrefslogtreecommitdiff
path: root/kernel/sched.c
diff options
context:
space:
mode:
authorDima Zavin <dima@android.com>2010-09-28 17:24:51 -0700
committerColin Cross <ccross@android.com>2010-10-04 12:08:04 -0700
commitcbb658990449df002eb9775f0b5ad104a7114b5f (patch)
tree4030eccaa8635fe2043f9c15c584b8e140955a24 /kernel/sched.c
parent3cfc28bd7cdb071d4c6b27c7a6aa84023ac211b6 (diff)
sched: normalize sleeper's vruntime during group change
If you switch the cgroup of a sleeping thread, its vruntime does not get adjusted correctly for the difference between the min_vruntime values of the two groups. This patch adds a new callback, prep_move_task, to struct sched_class to give sched_fair the opportunity to adjust the task's vruntime just before setting its new group. This allows us to properly normalize a sleeping task's vruntime when moving it between different cgroups. More details about the problem: http://lkml.org/lkml/2010/9/28/24 Cc: Arve Hjønnevåg <arve@android.com> Signed-off-by: Dima Zavin <dima@android.com>
Diffstat (limited to 'kernel/sched.c')
-rw-r--r--kernel/sched.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/kernel/sched.c b/kernel/sched.c
index 5e1142e7b9a7..17c6925e2016 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -8309,6 +8309,11 @@ void sched_move_task(struct task_struct *tsk)
if (unlikely(running))
tsk->sched_class->put_prev_task(rq, tsk);
+#ifdef CONFIG_FAIR_GROUP_SCHED
+ if (tsk->sched_class->prep_move_group)
+ tsk->sched_class->prep_move_group(tsk, on_rq);
+#endif
+
set_task_rq(tsk, task_cpu(tsk));
#ifdef CONFIG_FAIR_GROUP_SCHED