[PATCH 10/20] net: pktgen: Use kthread_create_on_node()

Frederic Weisbecker posted 20 patches 2 months ago
[PATCH 10/20] net: pktgen: Use kthread_create_on_node()
Posted by Frederic Weisbecker 2 months ago
Use the proper API instead of open coding it.

Signed-off-by: Frederic Weisbecker <frederic@kernel.org>
---
 net/core/pktgen.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/net/core/pktgen.c b/net/core/pktgen.c
index 34f68ef74b8f..7fcb4fc7a5d6 100644
--- a/net/core/pktgen.c
+++ b/net/core/pktgen.c
@@ -3883,17 +3883,14 @@ static int __net_init pktgen_create_thread(int cpu, struct pktgen_net *pn)
 	list_add_tail(&t->th_list, &pn->pktgen_threads);
 	init_completion(&t->start_done);
 
-	p = kthread_create_on_node(pktgen_thread_worker,
-				   t,
-				   cpu_to_node(cpu),
-				   "kpktgend_%d", cpu);
+	p = kthread_create_on_cpu(pktgen_thread_worker, t, cpu, "kpktgend_%d");
 	if (IS_ERR(p)) {
 		pr_err("kthread_create_on_node() failed for cpu %d\n", t->cpu);
 		list_del(&t->th_list);
 		kfree(t);
 		return PTR_ERR(p);
 	}
-	kthread_bind(p, cpu);
+
 	t->tsk = p;
 
 	pe = proc_create_data(t->tsk->comm, 0600, pn->proc_dir,
-- 
2.46.0
Re: [PATCH 10/20] net: pktgen: Use kthread_create_on_node()
Posted by Vishal Chourasia 1 month, 4 weeks ago
On Fri, Sep 27, 2024 at 12:48:58AM +0200, Frederic Weisbecker wrote:
> Use the proper API instead of open coding it.
> 
> Signed-off-by: Frederic Weisbecker <frederic@kernel.org>
> ---
>  net/core/pktgen.c | 7 ++-----
>  1 file changed, 2 insertions(+), 5 deletions(-)
> 
> diff --git a/net/core/pktgen.c b/net/core/pktgen.c
> index 34f68ef74b8f..7fcb4fc7a5d6 100644
> --- a/net/core/pktgen.c
> +++ b/net/core/pktgen.c
> @@ -3883,17 +3883,14 @@ static int __net_init pktgen_create_thread(int cpu, struct pktgen_net *pn)
>  	list_add_tail(&t->th_list, &pn->pktgen_threads);
>  	init_completion(&t->start_done);
>  
> -	p = kthread_create_on_node(pktgen_thread_worker,
> -				   t,
> -				   cpu_to_node(cpu),
> -				   "kpktgend_%d", cpu);
> +	p = kthread_create_on_cpu(pktgen_thread_worker, t, cpu, "kpktgend_%d");
Hi Frederic, 

The Subject line says "Use kthread_create_on_node()" while
kthread_create_on_cpu is used in the diff.


>  	if (IS_ERR(p)) {
>  		pr_err("kthread_create_on_node() failed for cpu %d\n", t->cpu);
>  		list_del(&t->th_list);
>  		kfree(t);
>  		return PTR_ERR(p);
>  	}
> -	kthread_bind(p, cpu);
> +
>  	t->tsk = p;
>  
>  	pe = proc_create_data(t->tsk->comm, 0600, pn->proc_dir,
> -- 
> 2.46.0
>
Re: [PATCH 10/20] net: pktgen: Use kthread_create_on_node()
Posted by Frederic Weisbecker 1 month ago
Le Mon, Sep 30, 2024 at 10:49:39PM +0530, Vishal Chourasia a écrit :
> On Fri, Sep 27, 2024 at 12:48:58AM +0200, Frederic Weisbecker wrote:
> > Use the proper API instead of open coding it.
> > 
> > Signed-off-by: Frederic Weisbecker <frederic@kernel.org>
> > ---
> >  net/core/pktgen.c | 7 ++-----
> >  1 file changed, 2 insertions(+), 5 deletions(-)
> > 
> > diff --git a/net/core/pktgen.c b/net/core/pktgen.c
> > index 34f68ef74b8f..7fcb4fc7a5d6 100644
> > --- a/net/core/pktgen.c
> > +++ b/net/core/pktgen.c
> > @@ -3883,17 +3883,14 @@ static int __net_init pktgen_create_thread(int cpu, struct pktgen_net *pn)
> >  	list_add_tail(&t->th_list, &pn->pktgen_threads);
> >  	init_completion(&t->start_done);
> >  
> > -	p = kthread_create_on_node(pktgen_thread_worker,
> > -				   t,
> > -				   cpu_to_node(cpu),
> > -				   "kpktgend_%d", cpu);
> > +	p = kthread_create_on_cpu(pktgen_thread_worker, t, cpu, "kpktgend_%d");
> Hi Frederic, 
> 
> The Subject line says "Use kthread_create_on_node()" while
> kthread_create_on_cpu is used in the diff.

Thanks!

Fixing this.
Re: [PATCH 10/20] net: pktgen: Use kthread_create_on_node()
Posted by Eric Dumazet 2 months ago
On Fri, Sep 27, 2024 at 12:49 AM Frederic Weisbecker
<frederic@kernel.org> wrote:
>
> Use the proper API instead of open coding it.
>
> Signed-off-by: Frederic Weisbecker <frederic@kernel.org>

Reviewed-by: Eric Dumazet <edumazet@google.com>