[PATCH 2/3] sched/core: no need to pick again after max is preempted
From: Aaron Lu
Date: Fri Aug 09 2019 - 02:48:01 EST
When sibling's task preempts current max, there is no need to do the
pick all over again - the preempted cpu could just pick idle and done.
Signed-off-by: Aaron Lu <ziqian.lzq@xxxxxxxxxx>
---
kernel/sched/core.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 84fec9933b74..e88583860abe 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -3756,7 +3756,6 @@ pick_next_task(struct rq *rq, struct task_struct *prev, struct rq_flags *rf)
* order.
*/
for_each_class(class) {
-again:
for_each_cpu_wrap(i, smt_mask, cpu) {
struct rq *rq_i = cpu_rq(i);
struct task_struct *p;
@@ -3828,10 +3827,10 @@ pick_next_task(struct rq *rq, struct task_struct *prev, struct rq_flags *rf)
if (j == i)
continue;
- cpu_rq(j)->core_pick = NULL;
+ cpu_rq(j)->core_pick = idle_sched_class.pick_task(cpu_rq(j));
}
occ = 1;
- goto again;
+ goto out;
} else {
/*
* Once we select a task for a cpu, we
@@ -3846,7 +3845,7 @@ pick_next_task(struct rq *rq, struct task_struct *prev, struct rq_flags *rf)
}
next_class:;
}
-
+out:
rq->core->core_pick_seq = rq->core->core_task_seq;
next = rq->core_pick;
rq->core_sched_seq = rq->core->core_pick_seq;
--
2.19.1.3.ge56e4f7
patch3: