linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH workqueues] Further upgrade queue_work_on() comment
@ 2023-04-28 23:47 Paul E. McKenney
  2023-05-09 15:37 ` Tejun Heo
  0 siblings, 1 reply; 2+ messages in thread
From: Paul E. McKenney @ 2023-04-28 23:47 UTC (permalink / raw)
  To: tj, jiangshanlai; +Cc: linux-kernel

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.

Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
Cc: Lai Jiangshan <jiangshanlai@gmail.com>
Cc: Tejun Heo <tj@kernel.org>

diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index b8b541caed48..2dd3308edc01 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -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.
  */

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH workqueues] Further upgrade queue_work_on() comment
  2023-04-28 23:47 [PATCH workqueues] Further upgrade queue_work_on() comment Paul E. McKenney
@ 2023-05-09 15:37 ` Tejun Heo
  0 siblings, 0 replies; 2+ messages in thread
From: Tejun Heo @ 2023-05-09 15:37 UTC (permalink / raw)
  To: Paul E. McKenney; +Cc: jiangshanlai, linux-kernel

On Fri, Apr 28, 2023 at 04:47:07PM -0700, Paul E. McKenney wrote:
> 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.
> 
> Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
> Cc: Lai Jiangshan <jiangshanlai@gmail.com>
> Cc: Tejun Heo <tj@kernel.org>

Applied to wq/for-6.5.

Thanks.

-- 
tejun

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-05-09 15:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-28 23:47 [PATCH workqueues] Further upgrade queue_work_on() comment Paul E. McKenney
2023-05-09 15:37 ` Tejun Heo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).