mbox series

[0/6] kthread: Add the helper macro kthread_run_on_cpu()

Message ID 20211021120135.3003-1-caihuoqing@baidu.com (mailing list archive)
Headers show
Series kthread: Add the helper macro kthread_run_on_cpu() | expand

Message

Cai,Huoqing Oct. 21, 2021, 12:01 p.m. UTC
the helper macro kthread_run_on_cpu() inculdes
kthread_create_on_cpu/wake_up_process().
In some cases, use kthread_run_on_cpu() directly instead of
kthread_create_on_node/kthread_bind/wake_up_process() or
kthread_create_on_cpu/wake_up_process() or
kthreadd_create/kthread_bind/wake_up_process() to simplify the code.

Cai Huoqing (6):
  kthread: Add the helper macro kthread_run_on_cpu()
  RDMA/siw: Make use of the helper macro kthread_run_on_cpu()
  ring-buffer: Make use of the helper macro kthread_run_on_cpu()
  rcutorture: Make use of the helper macro kthread_run_on_cpu()
  trace/osnoise: Make use of the helper macro kthread_run_on_cpu()
  trace/hwlat: Make use of the helper macro kthread_run_on_cpu()

 drivers/infiniband/sw/siw/siw_main.c |  7 +++----
 include/linux/kthread.h              | 22 ++++++++++++++++++++++
 kernel/rcu/rcutorture.c              |  7 ++-----
 kernel/trace/ring_buffer.c           |  7 ++-----
 kernel/trace/trace_hwlat.c           |  6 +-----
 kernel/trace/trace_osnoise.c         |  3 +--
 6 files changed, 31 insertions(+), 21 deletions(-)

Comments

Bernard Metzler Oct. 21, 2021, 1:48 p.m. UTC | #1
-----"Cai Huoqing" <caihuoqing@baidu.com> wrote: -----

>To: <caihuoqing@baidu.com>
>From: "Cai Huoqing" <caihuoqing@baidu.com>
>Date: 10/21/2021 02:02PM
>Cc: "Bernard Metzler" <bmt@zurich.ibm.com>, "Doug Ledford"
><dledford@redhat.com>, "Jason Gunthorpe" <jgg@ziepe.ca>, "Davidlohr
>Bueso" <dave@stgolabs.net>, "Paul E. McKenney" <paulmck@kernel.org>,
>"Josh Triplett" <josh@joshtriplett.org>, "Steven Rostedt"
><rostedt@goodmis.org>, "Mathieu Desnoyers"
><mathieu.desnoyers@efficios.com>, "Lai Jiangshan"
><jiangshanlai@gmail.com>, "Joel Fernandes" <joel@joelfernandes.org>,
>"Ingo Molnar" <mingo@redhat.com>, "Daniel Bristot de Oliveira"
><bristot@kernel.org>, <linux-rdma@vger.kernel.org>,
><linux-kernel@vger.kernel.org>, <rcu@vger.kernel.org>
>Subject: [EXTERNAL] [PATCH 0/6] kthread: Add the helper macro
>kthread_run_on_cpu()
>
>the helper macro kthread_run_on_cpu() inculdes
>kthread_create_on_cpu/wake_up_process().
>In some cases, use kthread_run_on_cpu() directly instead of
>kthread_create_on_node/kthread_bind/wake_up_process() or
>kthread_create_on_cpu/wake_up_process() or
>kthreadd_create/kthread_bind/wake_up_process() to simplify the code.

I do not see kthread_bind() being covered by the helper,
as claimed? rcutorture, ring-buffer, siw are using it in
the code potentially being replaced by the helper.
kthread_bind() is best to be called before thread starts
running, so should be part of it.

Thanks,
Bernard.
>
>Cai Huoqing (6):
>  kthread: Add the helper macro kthread_run_on_cpu()
>  RDMA/siw: Make use of the helper macro kthread_run_on_cpu()
>  ring-buffer: Make use of the helper macro kthread_run_on_cpu()
>  rcutorture: Make use of the helper macro kthread_run_on_cpu()
>  trace/osnoise: Make use of the helper macro kthread_run_on_cpu()
>  trace/hwlat: Make use of the helper macro kthread_run_on_cpu()
>
> drivers/infiniband/sw/siw/siw_main.c |  7 +++----
> include/linux/kthread.h              | 22 ++++++++++++++++++++++
> kernel/rcu/rcutorture.c              |  7 ++-----
> kernel/trace/ring_buffer.c           |  7 ++-----
> kernel/trace/trace_hwlat.c           |  6 +-----
> kernel/trace/trace_osnoise.c         |  3 +--
> 6 files changed, 31 insertions(+), 21 deletions(-)
>
>-- 
>2.25.1
>
>
Cai,Huoqing Oct. 21, 2021, 1:58 p.m. UTC | #2
Hi, folks
V2 is here
https://lore.kernel.org/lkml/20211021122758.3092-2-caihuoqing@baidu.com/

> -----Original Message-----
> From: Cai,Huoqing <caihuoqing@baidu.com>
> Sent: 2021年10月21日 20:01
> To: Cai,Huoqing
> Cc: Bernard Metzler; Doug Ledford; Jason Gunthorpe; Davidlohr Bueso; Paul
> E. McKenney; Josh Triplett; Steven Rostedt; Mathieu Desnoyers; Lai
> Jiangshan; Joel Fernandes; Ingo Molnar; Daniel Bristot de Oliveira; linux-
> rdma@vger.kernel.org; linux-kernel@vger.kernel.org; rcu@vger.kernel.org
> Subject: [PATCH 0/6] kthread: Add the helper macro kthread_run_on_cpu()
> 
> the helper macro kthread_run_on_cpu() inculdes
> kthread_create_on_cpu/wake_up_process().
> In some cases, use kthread_run_on_cpu() directly instead of
> kthread_create_on_node/kthread_bind/wake_up_process() or
> kthread_create_on_cpu/wake_up_process() or
> kthreadd_create/kthread_bind/wake_up_process() to simplify the code.
> 
> Cai Huoqing (6):
>   kthread: Add the helper macro kthread_run_on_cpu()
>   RDMA/siw: Make use of the helper macro kthread_run_on_cpu()
>   ring-buffer: Make use of the helper macro kthread_run_on_cpu()
>   rcutorture: Make use of the helper macro kthread_run_on_cpu()
>   trace/osnoise: Make use of the helper macro kthread_run_on_cpu()
>   trace/hwlat: Make use of the helper macro kthread_run_on_cpu()
> 
>  drivers/infiniband/sw/siw/siw_main.c |  7 +++----
>  include/linux/kthread.h              | 22 ++++++++++++++++++++++
>  kernel/rcu/rcutorture.c              |  7 ++-----
>  kernel/trace/ring_buffer.c           |  7 ++-----
>  kernel/trace/trace_hwlat.c           |  6 +-----
>  kernel/trace/trace_osnoise.c         |  3 +--
>  6 files changed, 31 insertions(+), 21 deletions(-)
> 
> --
> 2.25.1
Cai,Huoqing Oct. 21, 2021, 2:07 p.m. UTC | #3
On 21 10月 21 13:48:15, Bernard Metzler wrote:
> -----"Cai Huoqing" <caihuoqing@baidu.com> wrote: -----
> 
> >To: <caihuoqing@baidu.com>
> >From: "Cai Huoqing" <caihuoqing@baidu.com>
> >Date: 10/21/2021 02:02PM
> >Cc: "Bernard Metzler" <bmt@zurich.ibm.com>, "Doug Ledford"
> ><dledford@redhat.com>, "Jason Gunthorpe" <jgg@ziepe.ca>, "Davidlohr
> >Bueso" <dave@stgolabs.net>, "Paul E. McKenney" <paulmck@kernel.org>,
> >"Josh Triplett" <josh@joshtriplett.org>, "Steven Rostedt"
> ><rostedt@goodmis.org>, "Mathieu Desnoyers"
> ><mathieu.desnoyers@efficios.com>, "Lai Jiangshan"
> ><jiangshanlai@gmail.com>, "Joel Fernandes" <joel@joelfernandes.org>,
> >"Ingo Molnar" <mingo@redhat.com>, "Daniel Bristot de Oliveira"
> ><bristot@kernel.org>, <linux-rdma@vger.kernel.org>,
> ><linux-kernel@vger.kernel.org>, <rcu@vger.kernel.org>
> >Subject: [EXTERNAL] [PATCH 0/6] kthread: Add the helper macro
> >kthread_run_on_cpu()
> >
> >the helper macro kthread_run_on_cpu() inculdes
> >kthread_create_on_cpu/wake_up_process().
> >In some cases, use kthread_run_on_cpu() directly instead of
> >kthread_create_on_node/kthread_bind/wake_up_process() or
> >kthread_create_on_cpu/wake_up_process() or
> >kthreadd_create/kthread_bind/wake_up_process() to simplify the code.
> 
> I do not see kthread_bind() being covered by the helper,
> as claimed? rcutorture, ring-buffer, siw are using it in
> the code potentially being replaced by the helper.
> kthread_bind() is best to be called before thread starts
> running, so should be part of it.
Hi,
kthread_bind() is already part of kthread_create_on_cpu which is
called by kthread_run_on_cpu() here.

Thanks,
Cai.
> 
> Thanks,
> Bernard.
> >
> >Cai Huoqing (6):
> >  kthread: Add the helper macro kthread_run_on_cpu()
> >  RDMA/siw: Make use of the helper macro kthread_run_on_cpu()
> >  ring-buffer: Make use of the helper macro kthread_run_on_cpu()
> >  rcutorture: Make use of the helper macro kthread_run_on_cpu()
> >  trace/osnoise: Make use of the helper macro kthread_run_on_cpu()
> >  trace/hwlat: Make use of the helper macro kthread_run_on_cpu()
> >
> > drivers/infiniband/sw/siw/siw_main.c |  7 +++----
> > include/linux/kthread.h              | 22 ++++++++++++++++++++++
> > kernel/rcu/rcutorture.c              |  7 ++-----
> > kernel/trace/ring_buffer.c           |  7 ++-----
> > kernel/trace/trace_hwlat.c           |  6 +-----
> > kernel/trace/trace_osnoise.c         |  3 +--
> > 6 files changed, 31 insertions(+), 21 deletions(-)
> >
> >-- 
> >2.25.1
> >
> >
Bernard Metzler Oct. 21, 2021, 2:14 p.m. UTC | #4
-----"Cai Huoqing" <caihuoqing@baidu.com> wrote: -----

>To: "Bernard Metzler" <BMT@zurich.ibm.com>
>From: "Cai Huoqing" <caihuoqing@baidu.com>
>Date: 10/21/2021 04:08PM
>Cc: "Doug Ledford" <dledford@redhat.com>, "Jason Gunthorpe"
><jgg@ziepe.ca>, "Davidlohr Bueso" <dave@stgolabs.net>, "Paul E.
>McKenney" <paulmck@kernel.org>, "Josh Triplett"
><josh@joshtriplett.org>, "Steven Rostedt" <rostedt@goodmis.org>,
>"Mathieu Desnoyers" <mathieu.desnoyers@efficios.com>, "Lai Jiangshan"
><jiangshanlai@gmail.com>, "Joel Fernandes" <joel@joelfernandes.org>,
>"Ingo Molnar" <mingo@redhat.com>, "Daniel Bristot de Oliveira"
><bristot@kernel.org>, <linux-rdma@vger.kernel.org>,
><linux-kernel@vger.kernel.org>, <rcu@vger.kernel.org>
>Subject: [EXTERNAL] Re: [PATCH 0/6] kthread: Add the helper macro
>kthread_run_on_cpu()
>
>On 21 10月 21 13:48:15, Bernard Metzler wrote:
>> -----"Cai Huoqing" <caihuoqing@baidu.com> wrote: -----
>> 
>> >To: <caihuoqing@baidu.com>
>> >From: "Cai Huoqing" <caihuoqing@baidu.com>
>> >Date: 10/21/2021 02:02PM
>> >Cc: "Bernard Metzler" <bmt@zurich.ibm.com>, "Doug Ledford"
>> ><dledford@redhat.com>, "Jason Gunthorpe" <jgg@ziepe.ca>,
>"Davidlohr
>> >Bueso" <dave@stgolabs.net>, "Paul E. McKenney"
><paulmck@kernel.org>,
>> >"Josh Triplett" <josh@joshtriplett.org>, "Steven Rostedt"
>> ><rostedt@goodmis.org>, "Mathieu Desnoyers"
>> ><mathieu.desnoyers@efficios.com>, "Lai Jiangshan"
>> ><jiangshanlai@gmail.com>, "Joel Fernandes"
><joel@joelfernandes.org>,
>> >"Ingo Molnar" <mingo@redhat.com>, "Daniel Bristot de Oliveira"
>> ><bristot@kernel.org>, <linux-rdma@vger.kernel.org>,
>> ><linux-kernel@vger.kernel.org>, <rcu@vger.kernel.org>
>> >Subject: [EXTERNAL] [PATCH 0/6] kthread: Add the helper macro
>> >kthread_run_on_cpu()
>> >
>> >the helper macro kthread_run_on_cpu() inculdes
>> >kthread_create_on_cpu/wake_up_process().
>> >In some cases, use kthread_run_on_cpu() directly instead of
>> >kthread_create_on_node/kthread_bind/wake_up_process() or
>> >kthread_create_on_cpu/wake_up_process() or
>> >kthreadd_create/kthread_bind/wake_up_process() to simplify the
>code.
>> 
>> I do not see kthread_bind() being covered by the helper,
>> as claimed? rcutorture, ring-buffer, siw are using it in
>> the code potentially being replaced by the helper.
>> kthread_bind() is best to be called before thread starts
>> running, so should be part of it.
>Hi,
>kthread_bind() is already part of kthread_create_on_cpu which is
>called by kthread_run_on_cpu() here.
>

Indeed! Thanks, Bernard.

>Thanks,
>Cai.
>> 
>> Thanks,
>> Bernard.
>> >
>> >Cai Huoqing (6):
>> >  kthread: Add the helper macro kthread_run_on_cpu()
>> >  RDMA/siw: Make use of the helper macro kthread_run_on_cpu()
>> >  ring-buffer: Make use of the helper macro kthread_run_on_cpu()
>> >  rcutorture: Make use of the helper macro kthread_run_on_cpu()
>> >  trace/osnoise: Make use of the helper macro kthread_run_on_cpu()
>> >  trace/hwlat: Make use of the helper macro kthread_run_on_cpu()
>> >
>> > drivers/infiniband/sw/siw/siw_main.c |  7 +++----
>> > include/linux/kthread.h              | 22 ++++++++++++++++++++++
>> > kernel/rcu/rcutorture.c              |  7 ++-----
>> > kernel/trace/ring_buffer.c           |  7 ++-----
>> > kernel/trace/trace_hwlat.c           |  6 +-----
>> > kernel/trace/trace_osnoise.c         |  3 +--
>> > 6 files changed, 31 insertions(+), 21 deletions(-)
>> >
>> >-- 
>> >2.25.1
>> >
>> >
>