From: Zqiang Date: Mon, 22 Dec 2025 11:53:18 +0000 (+0800) Subject: sched_ext: Avoid multiple irq_work_queue() calls in destroy_dsq() X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=714d81423e9948fcdb4e3eb948ec188ffd2ac131;p=thirdparty%2Fkernel%2Flinux.git sched_ext: Avoid multiple irq_work_queue() calls in destroy_dsq() 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 Reviewed-by: Andrea Righi Signed-off-by: Tejun Heo --- diff --git a/kernel/sched/ext.c b/kernel/sched/ext.c index 8f6d8d7f895cc..136b01950a620 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);