[lkml]   [2020]   [Nov]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Patch in this message
Subject[PATCH -tip 11/32] sched: Enqueue task into core queue only after vruntime is updated
A waking task may have its vruntime adjusted. However, the code right
now puts it into the core queue without the adjustment. This means the
core queue may have a task with incorrect vruntime, potentially a very
long one. This may cause a task to get artificially boosted during

Fix it by enqueuing into the core queue only after the class-specific
enqueue callback has been called. This ensures that for CFS tasks, the
updated vruntime value is used when enqueuing the task into the core

Reviewed-by: Vineeth Pillai <>
Signed-off-by: Joel Fernandes (Google) <>
kernel/sched/core.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 53af817740c0..6aa76de55ef2 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -1753,9 +1753,6 @@ static inline void init_uclamp(void) { }

static inline void enqueue_task(struct rq *rq, struct task_struct *p, int flags)
- if (sched_core_enabled(rq))
- sched_core_enqueue(rq, p);
if (!(flags & ENQUEUE_NOCLOCK))

@@ -1766,6 +1763,9 @@ static inline void enqueue_task(struct rq *rq, struct task_struct *p, int flags)

uclamp_rq_inc(rq, p);
p->sched_class->enqueue_task(rq, p, flags);
+ if (sched_core_enabled(rq))
+ sched_core_enqueue(rq, p);

static inline void dequeue_task(struct rq *rq, struct task_struct *p, int flags)
 \ /
  Last update: 2020-11-18 00:22    [W:1.000 / U:0.096 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site