[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240711110720.1285-1-zhangqiao22@huawei.com>
Date: Thu, 11 Jul 2024 19:07:20 +0800
From: "Zhangqiao (2012 lab)" <zhangqiao22@...wei.com>
To: <tj@...nel.org>, <void@...ifault.com>
CC: <linux-kernel@...r.kernel.org>
Subject: [PATCH sched_ext/for-6.11] sched_ext: Reverting @p->sched_class if @p->disallow is set
From: Zhang Qiao <zhangqiao22@...wei.com>
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@...wei.com>
---
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
Powered by blists - more mailing lists