Skip to content

Commit

Permalink
sched: pull tasks when CPU is about to run SCHED_IDLE tasks
Browse files Browse the repository at this point in the history
Before a CPU switches from running SCHED_NORMAL task to
SCHED_IDLE task, trying to pull SCHED_NORMAL tasks from other
CPU by doing load_balance first.

Signed-off-by: Chen Xiaoguang <xiaoggchen@tencent.com>
Signed-off-by: Chen He <heddchen@tencent.com>
  • Loading branch information
txxxggg authored and intel-lab-lkp committed Dec 23, 2020
1 parent 5b78f2d commit 3dc62b6
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions kernel/sched/fair.c
Expand Up @@ -7029,6 +7029,11 @@ pick_next_task_fair(struct rq *rq, struct task_struct *prev, struct rq_flags *rf
struct task_struct *p;
int new_tasks;

if (prev &&
fair_policy(prev->policy) &&
sched_idle_cpu(rq->cpu))
goto idle;

again:
if (!sched_fair_runnable(rq))
goto idle;
Expand Down

0 comments on commit 3dc62b6

Please sign in to comment.