[PATCH] sched_ext: Use IRQ_WORK_INIT_HARD() to initialize sch->disable_irq_work

Zqiang posted 1 patch 1 month ago
kernel/sched/ext.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] sched_ext: Use IRQ_WORK_INIT_HARD() to initialize sch->disable_irq_work
Posted by Zqiang 1 month ago
For built with PREEMPT_RT kernels, the scx_disable_irq_workfn() is
called from per-cpu irq_work kthreads context, this means that
when call the scx_dump_state() in the scx_disable_irq_workfn() to
output current->comm/pid, it always output current irq_work kthread's
comm/pid. this commit therefore use the IRQ_WORK_INIT_HARD() to
initialize sch->disable_irq_work to make scx_disable_irq_workfn() is
called from hardirq context.

Signed-off-by: Zqiang <qiang.zhang@linux.dev>
---
 kernel/sched/ext.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/sched/ext.c b/kernel/sched/ext.c
index d5be34e7b8ae..ef4e8e6addd1 100644
--- a/kernel/sched/ext.c
+++ b/kernel/sched/ext.c
@@ -6770,7 +6770,7 @@ static struct scx_sched *scx_alloc_and_add_sched(struct scx_enable_cmd *cmd,
 
 	sch->slice_dfl = SCX_SLICE_DFL;
 	atomic_set(&sch->exit_kind, SCX_EXIT_NONE);
-	init_irq_work(&sch->disable_irq_work, scx_disable_irq_workfn);
+	sch->disable_irq_work = IRQ_WORK_INIT_HARD(scx_disable_irq_workfn);
 	kthread_init_work(&sch->disable_work, scx_disable_workfn);
 	timer_setup(&sch->bypass_lb_timer, scx_bypass_lb_timerfn, 0);
 
-- 
2.17.1
Re: [PATCH] sched_ext: Use IRQ_WORK_INIT_HARD() to initialize sch->disable_irq_work
Posted by Tejun Heo 1 month ago
Hello,

Applied to sched_ext/for-7.1-fixes with the following Fixes: tag added:

  Fixes: f4a6c506d118 ("sched_ext: Always bounce scx_disable() through irq_work")

Thanks.

--
tejun