* [PATCH v2] cpumask: Rephrase comments for cpu_any*() APIs
@ 2025-01-17 13:23 I Hsin Cheng
2025-01-17 13:48 ` Kuan-Wei Chiu
0 siblings, 1 reply; 3+ messages in thread
From: I Hsin Cheng @ 2025-01-17 13:23 UTC (permalink / raw)
To: yury.norov
Cc: mark.rutland, visitorckw, linux, linux-kernel, jserv, I Hsin Cheng
The cpu_any*() APIs comment states that it returns a "random" cpu within
the given cpumask. However 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.
v1 -> v2:
- Fix typo for Hoever/However
- Drop quotes around 'arbitrary' word
Signed-off-by: I Hsin Cheng <richard120310@gmail.com>
Reviewed-by: Kuan-Wei Chiu <visitorckw@gmail.com>
Reviewed-by: Mark Rutland <mark.rutland@arm.com>
Reviewed-by: Yury Norov <yury.norov@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..93be218fc 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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] cpumask: Rephrase comments for cpu_any*() APIs
2025-01-17 13:23 [PATCH v2] cpumask: Rephrase comments for cpu_any*() APIs I Hsin Cheng
@ 2025-01-17 13:48 ` Kuan-Wei Chiu
2025-01-17 14:19 ` I Hsin Cheng
0 siblings, 1 reply; 3+ messages in thread
From: Kuan-Wei Chiu @ 2025-01-17 13:48 UTC (permalink / raw)
To: I Hsin Cheng; +Cc: yury.norov, mark.rutland, linux, linux-kernel, jserv
Hi I Hsin,
On Fri, Jan 17, 2025 at 09:23:13PM +0800, I Hsin Cheng wrote:
> The cpu_any*() APIs comment states that it returns a "random" cpu within
> the given cpumask. However 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.
>
> v1 -> v2:
> - Fix typo for Hoever/However
> - Drop quotes around 'arbitrary' word
Don't add changelogs between versions above the ---. Add them below it.
Anything beyond --- will be part of the permanent changelog.
>
> Signed-off-by: I Hsin Cheng <richard120310@gmail.com>
> Reviewed-by: Kuan-Wei Chiu <visitorckw@gmail.com>
> Reviewed-by: Mark Rutland <mark.rutland@arm.com>
> Reviewed-by: Yury Norov <yury.norov@gmail.com>
Correct me if I'm wrong, but Yury and Mark didn't explicitly give a
Reviewed-by tag. Don't add any tags unless explicitly given.
Regards,
Kuan-Wei
> ---
> 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..93be218fc 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
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] cpumask: Rephrase comments for cpu_any*() APIs
2025-01-17 13:48 ` Kuan-Wei Chiu
@ 2025-01-17 14:19 ` I Hsin Cheng
0 siblings, 0 replies; 3+ messages in thread
From: I Hsin Cheng @ 2025-01-17 14:19 UTC (permalink / raw)
To: Kuan-Wei Chiu; +Cc: yury.norov, mark.rutland, linux, linux-kernel, jserv
On Fri, Jan 17, 2025 at 09:48:39PM +0800, Kuan-Wei Chiu wrote:
> Hi I Hsin,
>
> On Fri, Jan 17, 2025 at 09:23:13PM +0800, I Hsin Cheng wrote:
> > The cpu_any*() APIs comment states that it returns a "random" cpu within
> > the given cpumask. However 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.
> >
> > v1 -> v2:
> > - Fix typo for Hoever/However
> > - Drop quotes around 'arbitrary' word
>
> Don't add changelogs between versions above the ---. Add them below it.
> Anything beyond --- will be part of the permanent changelog.
>
> >
> > Signed-off-by: I Hsin Cheng <richard120310@gmail.com>
> > Reviewed-by: Kuan-Wei Chiu <visitorckw@gmail.com>
> > Reviewed-by: Mark Rutland <mark.rutland@arm.com>
> > Reviewed-by: Yury Norov <yury.norov@gmail.com>
>
> Correct me if I'm wrong, but Yury and Mark didn't explicitly give a
> Reviewed-by tag. Don't add any tags unless explicitly given.
I see, thanks alot!
I'm sorry for these mistakes, I'll correct them and send a v3.
Regards,
I Hsin
>
> Regards,
> Kuan-Wei
> > ---
> > 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..93be218fc 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
> >
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-01-17 14:19 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-01-17 13:23 [PATCH v2] cpumask: Rephrase comments for cpu_any*() APIs I Hsin Cheng
2025-01-17 13:48 ` Kuan-Wei Chiu
2025-01-17 14:19 ` I Hsin Cheng
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®