[PATCH 01/20] arm/bL_switcher: Use kthread_run_on_cpu()

Frederic Weisbecker posted 20 patches 1 month, 3 weeks ago
[PATCH 01/20] arm/bL_switcher: Use kthread_run_on_cpu()
Posted by Frederic Weisbecker 1 month, 3 weeks ago
Use the proper API instead of open coding it.

Signed-off-by: Frederic Weisbecker <frederic@kernel.org>
---
 arch/arm/common/bL_switcher.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/arch/arm/common/bL_switcher.c b/arch/arm/common/bL_switcher.c
index 9a9aa53547a6..d1e82a318e3b 100644
--- a/arch/arm/common/bL_switcher.c
+++ b/arch/arm/common/bL_switcher.c
@@ -307,13 +307,11 @@ static struct task_struct *bL_switcher_thread_create(int cpu, void *arg)
 {
 	struct task_struct *task;
 
-	task = kthread_create_on_node(bL_switcher_thread, arg,
-				      cpu_to_node(cpu), "kswitcher_%d", cpu);
-	if (!IS_ERR(task)) {
-		kthread_bind(task, cpu);
-		wake_up_process(task);
-	} else
+	task = kthread_run_on_cpu(bL_switcher_thread, arg,
+				  cpu, "kswitcher_%d");
+	if (IS_ERR(task))
 		pr_err("%s failed for CPU %d\n", __func__, cpu);
+
 	return task;
 }
 
-- 
2.45.2
Re: [PATCH 01/20] arm/bL_switcher: Use kthread_run_on_cpu()
Posted by Dave Martin 1 month, 1 week ago
Hi,

On Fri, Jul 26, 2024 at 11:56:37PM +0200, Frederic Weisbecker wrote:
> Use the proper API instead of open coding it.
> 
> Signed-off-by: Frederic Weisbecker <frederic@kernel.org>
> ---
>  arch/arm/common/bL_switcher.c | 10 ++++------
>  1 file changed, 4 insertions(+), 6 deletions(-)
> 
> diff --git a/arch/arm/common/bL_switcher.c b/arch/arm/common/bL_switcher.c
> index 9a9aa53547a6..d1e82a318e3b 100644
> --- a/arch/arm/common/bL_switcher.c
> +++ b/arch/arm/common/bL_switcher.c
> @@ -307,13 +307,11 @@ static struct task_struct *bL_switcher_thread_create(int cpu, void *arg)
>  {
>  	struct task_struct *task;
>  
> -	task = kthread_create_on_node(bL_switcher_thread, arg,
> -				      cpu_to_node(cpu), "kswitcher_%d", cpu);
> -	if (!IS_ERR(task)) {
> -		kthread_bind(task, cpu);
> -		wake_up_process(task);
> -	} else
> +	task = kthread_run_on_cpu(bL_switcher_thread, arg,
> +				  cpu, "kswitcher_%d");
> +	if (IS_ERR(task))
>  		pr_err("%s failed for CPU %d\n", __func__, cpu);
> +
>  	return task;
>  }

It's ages since I worked on this, but it looks like this is pure
refactoring.  So far as I can see, it does the right thing, so, FWIW:

Reviewed-by: Dave Martin <Dave.Martin@arm.com>

I don't currently have hardware I can test this on, though.

Nico (Cc added) might just possibly have an opinion on it, though this
looks uncontroversial.

Cheers
---Dave
Re: [PATCH 01/20] arm/bL_switcher: Use kthread_run_on_cpu()
Posted by Nicolas Pitre 1 month, 1 week ago
On Mon, 5 Aug 2024, Dave Martin wrote:

> Hi,
> 
> On Fri, Jul 26, 2024 at 11:56:37PM +0200, Frederic Weisbecker wrote:
> > Use the proper API instead of open coding it.
> > 
> > Signed-off-by: Frederic Weisbecker <frederic@kernel.org>
> > ---
> >  arch/arm/common/bL_switcher.c | 10 ++++------
> >  1 file changed, 4 insertions(+), 6 deletions(-)
> > 
> > diff --git a/arch/arm/common/bL_switcher.c b/arch/arm/common/bL_switcher.c
> > index 9a9aa53547a6..d1e82a318e3b 100644
> > --- a/arch/arm/common/bL_switcher.c
> > +++ b/arch/arm/common/bL_switcher.c
> > @@ -307,13 +307,11 @@ static struct task_struct *bL_switcher_thread_create(int cpu, void *arg)
> >  {
> >  	struct task_struct *task;
> >  
> > -	task = kthread_create_on_node(bL_switcher_thread, arg,
> > -				      cpu_to_node(cpu), "kswitcher_%d", cpu);
> > -	if (!IS_ERR(task)) {
> > -		kthread_bind(task, cpu);
> > -		wake_up_process(task);
> > -	} else
> > +	task = kthread_run_on_cpu(bL_switcher_thread, arg,
> > +				  cpu, "kswitcher_%d");
> > +	if (IS_ERR(task))
> >  		pr_err("%s failed for CPU %d\n", __func__, cpu);
> > +
> >  	return task;
> >  }
> 
> It's ages since I worked on this, but it looks like this is pure
> refactoring.  So far as I can see, it does the right thing, so, FWIW:
> 
> Reviewed-by: Dave Martin <Dave.Martin@arm.com>
> 
> I don't currently have hardware I can test this on, though.
> 
> Nico (Cc added) might just possibly have an opinion on it, though this
> looks uncontroversial.

No strong opinion.

Acked-by: Nicolas Pitre <nico@fluxnic.net>


Nicolas