Skip to contentSkip to conversation

stop_machine: Fix the documentation for a NULL cpus argument

PATCH In review Thomas Weißschuh 3 participants 6 messages Feb 17 – Feb 18

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 stop_machine: Fix the documentation for a NULL cpus argument

A recent refactoring of the kernel-docs for stop machine changed the description of the cpus parameter from "NULL = any online cpu" to "NULL = run on each online CPU".

However the callback is only executed on a single CPU, not all of them. The old wording was a bit ambiguous and could have been read both ways.

Reword the documentation to be correct again and hopefully also clearer.

Fixes fc6f89dc7078 ("stop_machine: Improve kernel-doc function-header comments")

---
There doesn't seem to be a formal maintainer for stop_machine. Paul, could you take this through your tree?

---
 include/linux/stop_machine.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
include/linux/stop_machine.h +2 -2
index 72820503514c..01011113d226 100644
@@ -99,7 +99,7 @@ static inline void print_stop_info(const char *log_lvl, struct task_struct *task
  * stop_machine: freeze the machine on all CPUs and run this function
  * @fn: the function to run
  * @data: the data ptr to pass to @fn()
- * @cpus: the cpus to run @fn() on (NULL = run on each online CPU)
+ * @cpus: the cpus to run @fn() on (NULL = one unspecified online CPU)
  *
  * Description: This causes a thread to be scheduled on every CPU, which
  * will run with interrupts disabled.  Each CPU specified by @cpus will
@@ -133,7 +133,7 @@ int stop_machine(cpu_stop_fn_t fn, void *data, const struct cpumask *cpus);
  * stop_machine_cpuslocked: freeze the machine on all CPUs and run this function
  * @fn: the function to run
  * @data: the data ptr to pass to @fn()
- * @cpus: the cpus to run @fn() on (NULL = run on each online CPU)
+ * @cpus: the cpus to run @fn() on (NULL = one unspecified online CPU)
  *
  * Same as above.  Avoids nested calls to cpus_read_lock().
  *

---
base-commit: 9702969978695d9a699a1f34771580cdbb153b33
change-id: 20260217-stop_machine-comment-795b2bd2a745

Best regards,

Signature · 1 line
Thomas Weißschuh <[email protected]>
#1 lore raw
Quoted 7 lines · Thomas Weißschuh

A recent refactoring of the kernel-docs for stop machine changed the description of the cpus parameter from "NULL = any online cpu" to "NULL = run on each online CPU".

However the callback is only executed on a single CPU, not all of them. The old wording was a bit ambiguous and could have been read both ways.

Quoted 7 lines

Reword the documentation to be correct again and hopefully also clearer.

Fixes fc6f89dc7078 ("stop_machine: Improve kernel-doc function-header comments")

---
There doesn't seem to be a formal maintainer for stop_machine. Paul, could you take this through your tree?

Good catch, and I have pulled it in for further review. Perhaps the various LLMs will test it as well? ;-)

Thanx, Paul

Quoted 35 lines
---
 include/linux/stop_machine.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
include/linux/stop_machine.h +2 -3
index 72820503514c..01011113d226 100644
@@ -99,7 +99,7 @@ static inline void print_stop_info(const char *log_lvl, struct task_struct *task
  * stop_machine: freeze the machine on all CPUs and run this function
  * @fn: the function to run
  * @data: the data ptr to pass to @fn()
- * @cpus: the cpus to run @fn() on (NULL = run on each online CPU)
+ * @cpus: the cpus to run @fn() on (NULL = one unspecified online CPU)
  *
  * Description: This causes a thread to be scheduled on every CPU, which
  * will run with interrupts disabled.  Each CPU specified by @cpus will
@@ -133,7 +133,7 @@ int stop_machine(cpu_stop_fn_t fn, void *data, const struct cpumask *cpus);
  * stop_machine_cpuslocked: freeze the machine on all CPUs and run this function
  * @fn: the function to run
  * @data: the data ptr to pass to @fn()
- * @cpus: the cpus to run @fn() on (NULL = run on each online CPU)
+ * @cpus: the cpus to run @fn() on (NULL = one unspecified online CPU)
  *
  * Same as above.  Avoids nested calls to cpus_read_lock().
  *
 
---

base-commit: 9702969978695d9a699a1f34771580cdbb153b33
change-id: 20260217-stop_machine-comment-795b2bd2a745

Best regards,

Signature · 1 line
Thomas Weißschuh <[email protected]>
#2 lore raw
In reply to Thomas Weißschuh
Quoted 8 lines · Thomas Weißschuh

A recent refactoring of the kernel-docs for stop machine changed the description of the cpus parameter from "NULL = any online cpu" to "NULL = run on each online CPU".

However the callback is only executed on a single CPU, not all of them. The old wording was a bit ambiguous and could have been read both ways.

Reword the documentation to be correct again and hopefully also clearer.

It is the first online CPU.
It temporary freezes all CPUs and runs the function the first online CPU. I would prefer this over "unspecified".
Unless you point that it does hold and CPU hotplug locks.

Quoted 2 lines
Fixes fc6f89dc7078 ("stop_machine: Improve kernel-doc function-header comments")

Sebastian

#3 lore raw
Quoted 11 lines · Sebastian Andrzej Siewior
Quoted 8 lines · Thomas Weißschuh

A recent refactoring of the kernel-docs for stop machine changed the description of the cpus parameter from "NULL = any online cpu" to "NULL = run on each online CPU".

However the callback is only executed on a single CPU, not all of them. The old wording was a bit ambiguous and could have been read both ways.

Reword the documentation to be correct again and hopefully also clearer.

It is the first online CPU.

Do we want to set that in stone?

Thanx, Paul

Quoted 8 lines

It temporary freezes all CPUs and runs the function the first online CPU. I would prefer this over "unspecified".
Unless you point that it does hold and CPU hotplug locks.

Quoted 2 lines
Fixes fc6f89dc7078 ("stop_machine: Improve kernel-doc function-header comments")

Sebastian

#4 lore raw
Quoted 6 lines · Paul E. McKenney
Quoted 5 lines · Sebastian Andrzej Siewior
Quoted 4 lines · Thomas Weißschuh

A recent refactoring of the kernel-docs for stop machine changed the description of the cpus parameter from "NULL = any online cpu" to "NULL = run on each online CPU".

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines

However the callback is only executed on a single CPU, not all of them. The old wording was a bit ambiguous and could have been read both ways.

Reword the documentation to be correct again and hopefully also clearer.

It is the first online CPU.

Do we want to set that in stone?

then keep it as is. I somehow don't like the wording but I'm not here for bike shedding.

Quoted 1 line

Thanx, Paul

Sebastian

#5 lore raw
Quoted 10 lines · Sebastian Andrzej Siewior
Quoted 9 lines · Paul E. McKenney
Quoted 8 lines · Sebastian Andrzej Siewior
Quoted 7 lines · Thomas Weißschuh

A recent refactoring of the kernel-docs for stop machine changed the description of the cpus parameter from "NULL = any online cpu" to "NULL = run on each online CPU".

However the callback is only executed on a single CPU, not all of them. The old wording was a bit ambiguous and could have been read both ways.

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line

Reword the documentation to be correct again and hopefully also clearer.

It is the first online CPU.

Do we want to set that in stone?

then keep it as is. I somehow don't like the wording but I'm not here for bike shedding.

I agree that it probably could be improved, but it does seem clear, correct, and unambiguous, so I also agree with leaving good enough alone. ;-)

Quoted 1 line

Applied and pushed, thank you!

Thanx, Paul