[PATCH] sched_ext: Avoid multiple irq_work_queue() calls in destroy_dsq()

From: Zqiang

Date: Mon Dec 22 2025 - 06:53:45 EST


This commit only make irq_work_queue() to be called when the
llist_add() returns true.

Signed-off-by: Zqiang <qiang.zhang@xxxxxxxxx>
---
kernel/sched/ext.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/sched/ext.c b/kernel/sched/ext.c
index 8f6d8d7f895c..136b01950a62 100644
--- a/kernel/sched/ext.c
+++ b/kernel/sched/ext.c
@@ -3439,8 +3439,8 @@ static void destroy_dsq(struct scx_sched *sch, u64 dsq_id)
* operations inside scheduler locks.
*/
dsq->id = SCX_DSQ_INVALID;
- llist_add(&dsq->free_node, &dsqs_to_free);
- irq_work_queue(&free_dsq_irq_work);
+ if (llist_add(&dsq->free_node, &dsqs_to_free))
+ irq_work_queue(&free_dsq_irq_work);

out_unlock_dsq:
raw_spin_unlock_irqrestore(&dsq->lock, flags);
--
2.17.1