From: "Cai,Huoqing" <caihuoqing@baidu.com>
To: "rostedt@goodmis.org" <rostedt@goodmis.org>
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>,
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-rdma@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"rcu@vger.kernel.org" <rcu@vger.kernel.org>
Subject: RE: [PATCH v3 1/6] kthread: Add the helper function kthread_run_on_cpu()
Date: Tue, 26 Oct 2021 08:32:30 +0000 [thread overview]
Message-ID: <40fae23eb02c4363bc75649e23f78c1c@baidu.com> (raw)
In-Reply-To: <20211022025711.3673-2-caihuoqing@baidu.com>
Hello,
Just a ping, to see if there are any more comments :-P
> -----Original Message-----
> From: Cai,Huoqing <caihuoqing@baidu.com>
> Sent: 2021年10月22日 10:57
> Subject: [PATCH v3 1/6] kthread: Add the helper function kthread_run_on_cpu()
>
> the helper function kthread_run_on_cpu() includes
> 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.
>
> Signed-off-by: Cai Huoqing <caihuoqing@baidu.com>
> ---
> v1->v2:
> *Remove cpu_to_node from kthread_create_on_cpu params.
> *Updated the macro description comment.
> v2->v3:
> *Convert this helper macro to static inline function
> *Fix typo in changelog
>
> v1 link:
> https://lore.kernel.org/lkml/20211021120135.3003-2-
> caihuoqing@baidu.com/
> v2 link:
> https://lore.kernel.org/lkml/20211021122758.3092-2-
> caihuoqing@baidu.com/
>
> include/linux/kthread.h | 25 +++++++++++++++++++++++++
> 1 file changed, 25 insertions(+)
>
> diff --git a/include/linux/kthread.h b/include/linux/kthread.h
> index 346b0f269161..db47aae7c481 100644
> --- a/include/linux/kthread.h
> +++ b/include/linux/kthread.h
> @@ -56,6 +56,31 @@ bool kthread_is_per_cpu(struct task_struct *k);
> __k; \
> })
>
> +/**
> + * kthread_run_on_cpu - create and wake a cpu bound thread.
> + * @threadfn: the function to run until signal_pending(current).
> + * @data: data ptr for @threadfn.
> + * @cpu: The cpu on which the thread should be bound,
> + * @namefmt: printf-style name for the thread. Format is restricted
> + * to "name.*%u". Code fills in cpu number.
> + *
> + * Description: Convenient wrapper for kthread_create_on_cpu()
> + * followed by wake_up_process(). Returns the kthread or
> + * ERR_PTR(-ENOMEM).
> + */
> +static inline struct task_struct *
> +kthread_run_on_cpu(int (*threadfn)(void *data), void *data,
> + unsigned int cpu, const char *namefmt)
> +{
> + struct task_struct *p;
> +
> + p = kthread_create_on_cpu(threadfn, data, cpu, namefmt);
> + if (!IS_ERR(p))
> + wake_up_process(p);
> +
> + return p;
> +}
> +
> void free_kthread_struct(struct task_struct *k);
> void kthread_bind(struct task_struct *k, unsigned int cpu);
> void kthread_bind_mask(struct task_struct *k, const struct cpumask *mask);
> --
> 2.25.1
next prev parent reply other threads:[~2021-10-26 8:32 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-22 2:57 [PATCH v3 0/6] kthread: Add the helper function kthread_run_on_cpu() Cai Huoqing
2021-10-22 2:57 ` [PATCH v3 1/6] " Cai Huoqing
2021-10-26 8:32 ` Cai,Huoqing [this message]
2021-11-16 21:01 ` Steven Rostedt
2021-10-22 2:57 ` [PATCH v3 2/6] RDMA/siw: Make use of " Cai Huoqing
2021-10-22 2:57 ` [PATCH v3 3/6] ring-buffer: " Cai Huoqing
2021-10-22 2:57 ` [PATCH v3 4/6] rcutorture: " Cai Huoqing
2021-10-22 2:57 ` [PATCH v3 5/6] trace/osnoise: " Cai Huoqing
2021-10-22 2:57 ` [PATCH v3 6/6] trace/hwlat: " Cai Huoqing
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=40fae23eb02c4363bc75649e23f78c1c@baidu.com \
--to=caihuoqing@baidu.com \
--cc=bmt@zurich.ibm.com \
--cc=bristot@kernel.org \
--cc=dave@stgolabs.net \
--cc=dledford@redhat.com \
--cc=jgg@ziepe.ca \
--cc=jiangshanlai@gmail.com \
--cc=joel@joelfernandes.org \
--cc=josh@joshtriplett.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=mathieu.desnoyers@efficios.com \
--cc=mingo@redhat.com \
--cc=paulmck@kernel.org \
--cc=rcu@vger.kernel.org \
--cc=rostedt@goodmis.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).