Skip to contentSkip to conversation

Further upgrade queue_work_on() comment

PATCH Applied Paul E. McKenney 2 participants 2 messages Apr 28, 2023 – May 9, 2023 Workqueue

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Further upgrade queue_work_on() comment

The current queue_work_on() docbook comment says that the caller must ensure that the specified CPU can't go away, and further says that the penalty for failing to nail down the specified CPU is that the workqueue handler might find itself executing on some other CPU. This is true as far as it goes, but fails to note what happens if the specified CPU never was online. Therefore, further expand this comment to say that specifying a CPU that was never online will result in a splat.

kernel/workqueue.c +2 -0
index b8b541caed48..2dd3308edc01 100644
@@ -1537,6 +1537,8 @@ static void __queue_work(int cpu, struct workqueue_struct *wq,
  * We queue the work to a specific CPU, the caller must ensure it
  * can't go away.  Callers that fail to ensure that the specified
  * CPU cannot go away will execute on a randomly chosen CPU.
+ * But note well that callers specifying a CPU that never has been
+ * online will get a splat.
  *
  * Return: %false if @work was already on a queue, %true otherwise.
  */
maintainer Applied
#1 lore raw
Quoted 11 lines · Paul E. McKenney

The current queue_work_on() docbook comment says that the caller must ensure that the specified CPU can't go away, and further says that the penalty for failing to nail down the specified CPU is that the workqueue handler might find itself executing on some other CPU. This is true as far as it goes, but fails to note what happens if the specified CPU never was online. Therefore, further expand this comment to say that specifying a CPU that was never online will result in a splat.

Applied to wq/for-6.5.

Thanks.

Signature · 1 line
tejun