[PATCH sched_ext/for-6.11] sched_ext: Reverting @p->sched_class if @p->disallow is set
From: Zhangqiao (2012 lab)
Date: Thu Jul 11 2024 - 07:11:37 EST
From: Zhang Qiao <zhangqiao22@xxxxxxxxxx>
when ops.init_task() sets @p->disallow, @p->policy was
reverted to @SCHED_NORMAL, but @p->sched_class was not,
so reverting p->sched_class to fair_sched_classs now.
Signed-off-by: Zhang Qiao <zhangqiao22@xxxxxxxxxx>
---
kernel/sched/ext.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/kernel/sched/ext.c b/kernel/sched/ext.c
index ae9ec8f..fb83edd 100644
--- a/kernel/sched/ext.c
+++ b/kernel/sched/ext.c
@@ -3220,13 +3220,14 @@ static int scx_ops_init_task(struct task_struct *p, struct task_group *tg, bool
/*
* We're either in fork or load path and @p->policy will be
- * applied right after. Reverting @p->policy here and rejecting
- * %SCHED_EXT transitions from scx_check_setscheduler()
+ * applied right after. Reverting @p->policy and @p->sched_class
+ * here and rejecting %SCHED_EXT transitions from scx_check_setscheduler()
* guarantees that if ops.init_task() sets @p->disallow, @p can
* never be in SCX.
*/
if (p->policy == SCHED_EXT) {
p->policy = SCHED_NORMAL;
+ p->sched_class = &fair_sched_class;
atomic_long_inc(&scx_nr_rejected);
}
--
2.45.2.windows.1