Skip to content

Commit 257a8be

Browse files
committed
Merge tag 'wq-for-6.13-rc6-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/wq
Pull workqueue fix from Tejun Heo: - Add a WARN_ON_ONCE() on queue_delayed_work_on() on an offline CPU as such work items won't get executed till the CPU comes back online * tag 'wq-for-6.13-rc6-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/wq: workqueue: warn if delayed_work is queued to an offlined cpu.
2 parents da13af8 + da30ba2 commit 257a8be

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

kernel/workqueue.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2508,6 +2508,7 @@ static void __queue_delayed_work(int cpu, struct workqueue_struct *wq,
25082508
return;
25092509
}
25102510

2511+
WARN_ON_ONCE(cpu != WORK_CPU_UNBOUND && !cpu_online(cpu));
25112512
dwork->wq = wq;
25122513
dwork->cpu = cpu;
25132514
timer->expires = jiffies + delay;
@@ -2533,6 +2534,12 @@ static void __queue_delayed_work(int cpu, struct workqueue_struct *wq,
25332534
* @dwork: work to queue
25342535
* @delay: number of jiffies to wait before queueing
25352536
*
2537+
* We queue the delayed_work to a specific CPU, for non-zero delays the
2538+
* caller must ensure it is online and can't go away. Callers that fail
2539+
* to ensure this, may get @dwork->timer queued to an offlined CPU and
2540+
* this will prevent queueing of @dwork->work unless the offlined CPU
2541+
* becomes online again.
2542+
*
25362543
* Return: %false if @work was already on a queue, %true otherwise. If
25372544
* @delay is zero and @dwork is idle, it will be scheduled for immediate
25382545
* execution.

0 commit comments

Comments
 (0)