]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
sched_ext: Avoid multiple irq_work_queue() calls in destroy_dsq()
authorZqiang <qiang.zhang@linux.dev>
Mon, 22 Dec 2025 11:53:18 +0000 (19:53 +0800)
committerTejun Heo <tj@kernel.org>
Tue, 23 Dec 2025 03:55:41 +0000 (17:55 -1000)
llist_add() returns true only when adding to an empty list, which indicates
that no IRQ work is currently queued or running. Therefore, we only need to
call irq_work_queue() when llist_add() returns true, to avoid unnecessarily
re-queueing IRQ work that is already pending or executing.

Signed-off-by: Zqiang <qiang.zhang@linux.dev>
Reviewed-by: Andrea Righi <arighi@nvidia.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
kernel/sched/ext.c

index 8f6d8d7f895ccc494414e971d370229da7c7ffe1..136b01950a62007ac48260c959310e167d8276cc 100644 (file)
@@ -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);