Skip to content

Commit 714d814

Browse files
Zqianghtejun
authored andcommitted
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 <qiang.zhang@linux.dev> Reviewed-by: Andrea Righi <arighi@nvidia.com> Signed-off-by: Tejun Heo <tj@kernel.org>
1 parent ccaeeb5 commit 714d814

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

kernel/sched/ext.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3439,8 +3439,8 @@ static void destroy_dsq(struct scx_sched *sch, u64 dsq_id)
34393439
* operations inside scheduler locks.
34403440
*/
34413441
dsq->id = SCX_DSQ_INVALID;
3442-
llist_add(&dsq->free_node, &dsqs_to_free);
3443-
irq_work_queue(&free_dsq_irq_work);
3442+
if (llist_add(&dsq->free_node, &dsqs_to_free))
3443+
irq_work_queue(&free_dsq_irq_work);
34443444

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

0 commit comments

Comments
 (0)