All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] smp: Fix the comments of smp_call_function_many()
@ 2021-12-13  3:57 Zhen Lei
  2021-12-13 18:05 ` Dave Hansen
  0 siblings, 1 reply; 3+ messages in thread
From: Zhen Lei @ 2021-12-13  3:57 UTC (permalink / raw)
  To: Ingo Molnar, Peter Zijlstra, linux-kernel
  Cc: Zhen Lei, Nadav Amit, Dave Hansen

As commit a32a4d8a815c ("smp: Run functions concurrently in
smp_call_function_many_cond()") itself says:
                  "Keep other smp_call_function_many() semantic as it is
today for backward compatibility: the called function is not executed in
this case locally."

It's clear that, the function header comments of smp_call_function_many()
does not need to be changed.

So move the comment about 'scf_flags' to smp_call_function_many_cond(),
and restore the original comments of smp_call_function_many().

Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
---
 kernel/smp.c | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/kernel/smp.c b/kernel/smp.c
index 01a7c1706a58b1d..6ec884f41b7506d 100644
--- a/kernel/smp.c
+++ b/kernel/smp.c
@@ -861,6 +861,13 @@ EXPORT_SYMBOL_GPL(smp_call_function_any);
 #define SCF_WAIT	(1U << 0)
 #define SCF_RUN_LOCAL	(1U << 1)
 
+/**
+ * smp_call_function_many_cond(): Run a function on a set of CPUs.
+ * @scf_flags: Bitmask that controls the operation. If %SCF_WAIT is set,
+ *        wait (atomically) until function has completed on other CPUs. If
+ *        %SCF_RUN_LOCAL is set, the function will also be run locally
+ *        if the local CPU is set in the @cpumask.
+ */
 static void smp_call_function_many_cond(const struct cpumask *mask,
 					smp_call_func_t func, void *info,
 					unsigned int scf_flags,
@@ -972,14 +979,12 @@ static void smp_call_function_many_cond(const struct cpumask *mask,
 }
 
 /**
- * smp_call_function_many(): Run a function on a set of CPUs.
+ * smp_call_function_many(): Run a function on a set of other CPUs.
  * @mask: The set of cpus to run on (only runs on online subset).
  * @func: The function to run. This must be fast and non-blocking.
  * @info: An arbitrary pointer to pass to the function.
- * @wait: Bitmask that controls the operation. If %SCF_WAIT is set, wait
- *        (atomically) until function has completed on other CPUs. If
- *        %SCF_RUN_LOCAL is set, the function will also be run locally
- *        if the local CPU is set in the @cpumask.
+ * @wait: If true, wait (atomically) until function has completed
+ *        on other CPUs.
  *
  * If @wait is true, then returns once @func has returned.
  *
-- 
2.25.1


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

* Re: [PATCH] smp: Fix the comments of smp_call_function_many()
  2021-12-13  3:57 [PATCH] smp: Fix the comments of smp_call_function_many() Zhen Lei
@ 2021-12-13 18:05 ` Dave Hansen
  2021-12-14  7:24   ` Leizhen (ThunderTown)
  0 siblings, 1 reply; 3+ messages in thread
From: Dave Hansen @ 2021-12-13 18:05 UTC (permalink / raw)
  To: Zhen Lei, Ingo Molnar, Peter Zijlstra, linux-kernel
  Cc: Nadav Amit, Dave Hansen

On 12/12/21 7:57 PM, Zhen Lei wrote:
> diff --git a/kernel/smp.c b/kernel/smp.c
> index 01a7c1706a58b1d..6ec884f41b7506d 100644
> --- a/kernel/smp.c
> +++ b/kernel/smp.c
> @@ -861,6 +861,13 @@ EXPORT_SYMBOL_GPL(smp_call_function_any);
>  #define SCF_WAIT	(1U << 0)
>  #define SCF_RUN_LOCAL	(1U << 1)
>  
> +/**
> + * smp_call_function_many_cond(): Run a function on a set of CPUs.
> + * @scf_flags: Bitmask that controls the operation. If %SCF_WAIT is set,
> + *        wait (atomically) until function has completed on other CPUs. If
> + *        %SCF_RUN_LOCAL is set, the function will also be run locally
> + *        if the local CPU is set in the @cpumask.
> + */

Fixing up the smp_call_function_many() comment is a good idea.  But, the
new smp_call_function_many_cond() comment duplicates these which are
_just_ above it:

> /*
>  * Flags to be used as scf_flags argument of smp_call_function_many_cond().
>  *
>  * %SCF_WAIT:           Wait until function execution is completed
>  * %SCF_RUN_LOCAL:      Run also locally if local cpu is set in cpumask
>  */
> #define SCF_WAIT        (1U << 0)
> #define SCF_RUN_LOCAL   (1U << 1)

Could we comment the bits in one place?

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

* Re: [PATCH] smp: Fix the comments of smp_call_function_many()
  2021-12-13 18:05 ` Dave Hansen
@ 2021-12-14  7:24   ` Leizhen (ThunderTown)
  0 siblings, 0 replies; 3+ messages in thread
From: Leizhen (ThunderTown) @ 2021-12-14  7:24 UTC (permalink / raw)
  To: Dave Hansen, Ingo Molnar, Peter Zijlstra, linux-kernel
  Cc: Nadav Amit, Dave Hansen



On 2021/12/14 2:05, Dave Hansen wrote:
> On 12/12/21 7:57 PM, Zhen Lei wrote:
>> diff --git a/kernel/smp.c b/kernel/smp.c
>> index 01a7c1706a58b1d..6ec884f41b7506d 100644
>> --- a/kernel/smp.c
>> +++ b/kernel/smp.c
>> @@ -861,6 +861,13 @@ EXPORT_SYMBOL_GPL(smp_call_function_any);
>>  #define SCF_WAIT	(1U << 0)
>>  #define SCF_RUN_LOCAL	(1U << 1)
>>  
>> +/**
>> + * smp_call_function_many_cond(): Run a function on a set of CPUs.
>> + * @scf_flags: Bitmask that controls the operation. If %SCF_WAIT is set,
>> + *        wait (atomically) until function has completed on other CPUs. If
>> + *        %SCF_RUN_LOCAL is set, the function will also be run locally
>> + *        if the local CPU is set in the @cpumask.
>> + */
> 
> Fixing up the smp_call_function_many() comment is a good idea.  But, the
> new smp_call_function_many_cond() comment duplicates these which are
> _just_ above it:

Yes, maybe we just need to list SCF_WAIT and SCF_RUN_LOCAL here.

> 
>> /*
>>  * Flags to be used as scf_flags argument of smp_call_function_many_cond().
>>  *
>>  * %SCF_WAIT:           Wait until function execution is completed
>>  * %SCF_RUN_LOCAL:      Run also locally if local cpu is set in cpumask
>>  */
>> #define SCF_WAIT        (1U << 0)
>> #define SCF_RUN_LOCAL   (1U << 1)
> 
> Could we comment the bits in one place?

Yes, I think we should delete the line "Flags to be used ..."

> .
> 

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

end of thread, other threads:[~2021-12-14  7:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-13  3:57 [PATCH] smp: Fix the comments of smp_call_function_many() Zhen Lei
2021-12-13 18:05 ` Dave Hansen
2021-12-14  7:24   ` Leizhen (ThunderTown)

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.