aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--kernel/sched/fair.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 858b94ab1bd2..f0950fde1f5b 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -7930,16 +7930,31 @@ static void switched_from_fair(struct rq *rq, struct task_struct *p)
7930 */ 7930 */
7931static void switched_to_fair(struct rq *rq, struct task_struct *p) 7931static void switched_to_fair(struct rq *rq, struct task_struct *p)
7932{ 7932{
7933#ifdef CONFIG_FAIR_GROUP_SCHED
7934 struct sched_entity *se = &p->se; 7933 struct sched_entity *se = &p->se;
7934
7935#ifdef CONFIG_FAIR_GROUP_SCHED
7935 /* 7936 /*
7936 * Since the real-depth could have been changed (only FAIR 7937 * Since the real-depth could have been changed (only FAIR
7937 * class maintain depth value), reset depth properly. 7938 * class maintain depth value), reset depth properly.
7938 */ 7939 */
7939 se->depth = se->parent ? se->parent->depth + 1 : 0; 7940 se->depth = se->parent ? se->parent->depth + 1 : 0;
7940#endif 7941#endif
7941 if (!task_on_rq_queued(p)) 7942
7943 if (!task_on_rq_queued(p)) {
7944
7945 /*
7946 * Ensure the task has a non-normalized vruntime when it is switched
7947 * back to the fair class with !queued, so that enqueue_entity() at
7948 * wake-up time will do the right thing.
7949 *
7950 * If it's queued, then the enqueue_entity(.flags=0) makes the task
7951 * has non-normalized vruntime, if it's !queued, then it still has
7952 * normalized vruntime.
7953 */
7954 if (p->state != TASK_RUNNING)
7955 se->vruntime += cfs_rq_of(se)->min_vruntime;
7942 return; 7956 return;
7957 }
7943 7958
7944 /* 7959 /*
7945 * We were most likely switched from sched_rt, so 7960 * We were most likely switched from sched_rt, so