public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] sched_ext: Use IRQ_WORK_INIT_HARD() to initialize rq->scx.kick_cpus_irq_work
@ 2025-11-17 12:53 Zqiang
  2025-11-17 12:53 ` [PATCH] sched_ext: Use kvfree_rcu() to release per-cpu ksyncs object Zqiang
  2025-11-17 15:15 ` [PATCH] sched_ext: Use IRQ_WORK_INIT_HARD() to initialize rq->scx.kick_cpus_irq_work Tejun Heo
  0 siblings, 2 replies; 4+ messages in thread
From: Zqiang @ 2025-11-17 12:53 UTC (permalink / raw)
  To: tj, void, arighi, changwoo
  Cc: sched-ext, linux-kernel, qiang.zhang, qiang.zhang1211

For PREEMPT_RT kernels, the kick_cpus_irq_workfn() be invoked in
the per-cpu irq_work/* task context and there is no rcu-read critical
section to protect. this commit therefore use IRQ_WORK_INIT_HARD() to
initialize the per-cpu rq->scx.kick_cpus_irq_work in the
init_sched_ext_class().

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 8b88a9e69f8a..c8de9ec70d75 100644
--- a/kernel/sched/ext.c
+++ b/kernel/sched/ext.c
@@ -5628,7 +5628,7 @@ void __init init_sched_ext_class(void)
 		BUG_ON(!zalloc_cpumask_var_node(&rq->scx.cpus_to_preempt, GFP_KERNEL, n));
 		BUG_ON(!zalloc_cpumask_var_node(&rq->scx.cpus_to_wait, GFP_KERNEL, n));
 		rq->scx.deferred_irq_work = IRQ_WORK_INIT_HARD(deferred_irq_workfn);
-		init_irq_work(&rq->scx.kick_cpus_irq_work, kick_cpus_irq_workfn);
+		rq->scx.kick_cpus_irq_work = IRQ_WORK_INIT_HARD(kick_cpus_irq_workfn);
 
 		if (cpu_online(cpu))
 			cpu_rq(cpu)->scx.flags |= SCX_RQ_ONLINE;
-- 
2.48.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH] sched_ext: Use kvfree_rcu() to release per-cpu ksyncs object
  2025-11-17 12:53 [PATCH] sched_ext: Use IRQ_WORK_INIT_HARD() to initialize rq->scx.kick_cpus_irq_work Zqiang
@ 2025-11-17 12:53 ` Zqiang
  2025-11-17 15:18   ` Tejun Heo
  2025-11-17 15:15 ` [PATCH] sched_ext: Use IRQ_WORK_INIT_HARD() to initialize rq->scx.kick_cpus_irq_work Tejun Heo
  1 sibling, 1 reply; 4+ messages in thread
From: Zqiang @ 2025-11-17 12:53 UTC (permalink / raw)
  To: tj, void, arighi, changwoo
  Cc: sched-ext, linux-kernel, qiang.zhang, qiang.zhang1211

The free_kick_syncs_rcu() rcu-callback only invoke kvfree() to
release per-cpu ksyncs object, this can use kvfree_rcu() replace
call_rcu() to release per-cpu ksyncs object in the free_kick_syncs().

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

diff --git a/kernel/sched/ext.c b/kernel/sched/ext.c
index c8de9ec70d75..fe94daea7889 100644
--- a/kernel/sched/ext.c
+++ b/kernel/sched/ext.c
@@ -4161,13 +4161,6 @@ static const char *scx_exit_reason(enum scx_exit_kind kind)
 	}
 }
 
-static void free_kick_syncs_rcu(struct rcu_head *rcu)
-{
-	struct scx_kick_syncs *ksyncs = container_of(rcu, struct scx_kick_syncs, rcu);
-
-	kvfree(ksyncs);
-}
-
 static void free_kick_syncs(void)
 {
 	int cpu;
@@ -4178,7 +4171,7 @@ static void free_kick_syncs(void)
 
 		to_free = rcu_replace_pointer(*ksyncs, NULL, true);
 		if (to_free)
-			call_rcu(&to_free->rcu, free_kick_syncs_rcu);
+			kvfree_rcu(to_free, rcu);
 	}
 }
 
-- 
2.48.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] sched_ext: Use IRQ_WORK_INIT_HARD() to initialize rq->scx.kick_cpus_irq_work
  2025-11-17 12:53 [PATCH] sched_ext: Use IRQ_WORK_INIT_HARD() to initialize rq->scx.kick_cpus_irq_work Zqiang
  2025-11-17 12:53 ` [PATCH] sched_ext: Use kvfree_rcu() to release per-cpu ksyncs object Zqiang
@ 2025-11-17 15:15 ` Tejun Heo
  1 sibling, 0 replies; 4+ messages in thread
From: Tejun Heo @ 2025-11-17 15:15 UTC (permalink / raw)
  To: Zqiang; +Cc: void, arighi, changwoo, sched-ext, linux-kernel, qiang.zhang1211

Applied to sched_ext/for-6.18-fixes.

Thanks.
--
tejun

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] sched_ext: Use kvfree_rcu() to release per-cpu ksyncs object
  2025-11-17 12:53 ` [PATCH] sched_ext: Use kvfree_rcu() to release per-cpu ksyncs object Zqiang
@ 2025-11-17 15:18   ` Tejun Heo
  0 siblings, 0 replies; 4+ messages in thread
From: Tejun Heo @ 2025-11-17 15:18 UTC (permalink / raw)
  To: Zqiang; +Cc: void, arighi, changwoo, sched-ext, linux-kernel, qiang.zhang1211

Applied to sched_ext/for-6.19.

Thanks.
--
tejun

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-11-17 15:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-17 12:53 [PATCH] sched_ext: Use IRQ_WORK_INIT_HARD() to initialize rq->scx.kick_cpus_irq_work Zqiang
2025-11-17 12:53 ` [PATCH] sched_ext: Use kvfree_rcu() to release per-cpu ksyncs object Zqiang
2025-11-17 15:18   ` Tejun Heo
2025-11-17 15:15 ` [PATCH] sched_ext: Use IRQ_WORK_INIT_HARD() to initialize rq->scx.kick_cpus_irq_work Tejun Heo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox