[PATCH] cpumask: Rephrase comments for cpu_any*() APIs

I Hsin Cheng posted 1 patch 11 months ago
There is a newer version of this series
include/linux/cpumask.h | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
[PATCH] cpumask: Rephrase comments for cpu_any*() APIs
Posted by I Hsin Cheng 11 months ago
The cpu_any*() APIs comment states that it returns a "random" cpu within
the given cpumask. Hoever it's not actually random as random itself
stands a meaning for uniform distribution.

cpu_any*() APIs are a naming convention for the caller to states that it
doesn't care which CPU it gets, so change "random" to "arbitrary" would
be more appropriate.

Signed-off-by: I Hsin Cheng <richard120310@gmail.com>
---
 include/linux/cpumask.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/include/linux/cpumask.h b/include/linux/cpumask.h
index 9278a50d5..2769419a0 100644
--- a/include/linux/cpumask.h
+++ b/include/linux/cpumask.h
@@ -391,7 +391,7 @@ unsigned int __pure cpumask_next_wrap(int n, const struct cpumask *mask, int sta
 	for_each_set_bit_from(cpu, cpumask_bits(mask), small_cpumask_bits)
 
 /**
- * cpumask_any_but - return a "random" in a cpumask, but not this one.
+ * cpumask_any_but - return an "arbitrary" cpu in a cpumask, but not this one.
  * @mask: the cpumask to search
  * @cpu: the cpu to ignore.
  *
@@ -411,7 +411,7 @@ unsigned int cpumask_any_but(const struct cpumask *mask, unsigned int cpu)
 }
 
 /**
- * cpumask_any_and_but - pick a "random" cpu from *mask1 & *mask2, but not this one.
+ * cpumask_any_and_but - pick an "arbitrary" cpu from *mask1 & *mask2, but not this one.
  * @mask1: the first input cpumask
  * @mask2: the second input cpumask
  * @cpu: the cpu to ignore
@@ -840,7 +840,7 @@ void cpumask_copy(struct cpumask *dstp, const struct cpumask *srcp)
 }
 
 /**
- * cpumask_any - pick a "random" cpu from *srcp
+ * cpumask_any - pick an "arbitrary" cpu from *srcp
  * @srcp: the input cpumask
  *
  * Return: >= nr_cpu_ids if no cpus set.
@@ -848,7 +848,7 @@ void cpumask_copy(struct cpumask *dstp, const struct cpumask *srcp)
 #define cpumask_any(srcp) cpumask_first(srcp)
 
 /**
- * cpumask_any_and - pick a "random" cpu from *mask1 & *mask2
+ * cpumask_any_and - pick an "arbitrary" cpu from *mask1 & *mask2
  * @mask1: the first input cpumask
  * @mask2: the second input cpumask
  *
-- 
2.43.0
Re: [PATCH] cpumask: Rephrase comments for cpu_any*() APIs
Posted by Kuan-Wei Chiu 11 months ago
On Wed, Jan 15, 2025 at 03:19:32PM +0800, I Hsin Cheng wrote:
> The cpu_any*() APIs comment states that it returns a "random" cpu within
> the given cpumask. Hoever it's not actually random as random itself

s/Hoever/However

> stands a meaning for uniform distribution.
> 
> cpu_any*() APIs are a naming convention for the caller to states that it
> doesn't care which CPU it gets, so change "random" to "arbitrary" would
> be more appropriate.
> 
> Signed-off-by: I Hsin Cheng <richard120310@gmail.com>

With the above corrections:

Reviewed-by: Kuan-Wei Chiu <visitorckw@gmail.com>

Regards,
Kuan-Wei
Re: [PATCH] cpumask: Rephrase comments for cpu_any*() APIs
Posted by Yury Norov 11 months ago
On Wed, Jan 15, 2025 at 08:55:50PM +0800, Kuan-Wei Chiu wrote:
> On Wed, Jan 15, 2025 at 03:19:32PM +0800, I Hsin Cheng wrote:
> > The cpu_any*() APIs comment states that it returns a "random" cpu within
> > the given cpumask. Hoever it's not actually random as random itself
> 
> s/Hoever/However

Hi I Hsin,

Can you please fix this typo, drop quotes around the 'arbitrary' word,
as suggested by Mark, and send v2?

Please also keep Mark in the loop.

Thanks,
Yury

> 
> > stands a meaning for uniform distribution.
> > 
> > cpu_any*() APIs are a naming convention for the caller to states that it
> > doesn't care which CPU it gets, so change "random" to "arbitrary" would
> > be more appropriate.
> > 
> > Signed-off-by: I Hsin Cheng <richard120310@gmail.com>
> 
> With the above corrections:
> 
> Reviewed-by: Kuan-Wei Chiu <visitorckw@gmail.com>
> 
> Regards,
> Kuan-Wei
Re: [PATCH] cpumask: Rephrase comments for cpu_any*() APIs
Posted by I Hsin Cheng 11 months ago
On Wed, Jan 15, 2025 at 10:55:13AM -0500, Yury Norov wrote:
> On Wed, Jan 15, 2025 at 08:55:50PM +0800, Kuan-Wei Chiu wrote:
> > On Wed, Jan 15, 2025 at 03:19:32PM +0800, I Hsin Cheng wrote:
> > > The cpu_any*() APIs comment states that it returns a "random" cpu within
> > > the given cpumask. Hoever it's not actually random as random itself
> > 
> > s/Hoever/However
> 
> Hi I Hsin,
> 
> Can you please fix this typo, drop quotes around the 'arbitrary' word,
> as suggested by Mark, and send v2?

No problem, I'll fix it and send v2 asap.
> 
> Please also keep Mark in the loop.
> 

Sorry I must've missed to CC the patch to Mark, I'll recheck everyone's
email again.

Regards,
I Hsin

> Thanks,
> Yury
> 
> > 
> > > stands a meaning for uniform distribution.
> > > 
> > > cpu_any*() APIs are a naming convention for the caller to states that it
> > > doesn't care which CPU it gets, so change "random" to "arbitrary" would
> > > be more appropriate.
> > > 
> > > Signed-off-by: I Hsin Cheng <richard120310@gmail.com>
> > 
> > With the above corrections:
> > 
> > Reviewed-by: Kuan-Wei Chiu <visitorckw@gmail.com>
> > 
> > Regards,
> > Kuan-Wei