Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1426970
| From | Tejun Heo <tj@kernel.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH v9 05/12] kthread: Add kthread_create_worker*() |
| Date | 2016-06-20 22:00 +0200 |
| Message-ID | <rMdwt-44L-7@gated-at.bofh.it> (permalink) |
| References | <rKDv3-7Hj-3@gated-at.bofh.it> <rKDv3-7Hj-7@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Thu, Jun 16, 2016 at 01:17:24PM +0200, Petr Mladek wrote: > Kthread workers are currently created using the classic kthread API, > namely kthread_run(). kthread_worker_fn() is passed as the @threadfn > parameter. > > This patch defines kthread_create_worker() and > kthread_create_worker_on_cpu() functions that hide implementation details. > > They enforce using kthread_worker_fn() for the main thread. But I doubt > that there are any plans to create any alternative. In fact, I think > that we do not want any alternative main thread because it would be > hard to support consistency with the rest of the kthread worker API. > > The naming and function of kthread_create_worker() is inspired by > the workqueues API like the rest of the kthread worker API. > > The kthread_create_worker_on_cpu() variant is motivated by the original > kthread_create_on_cpu(). Note that we need to bind per-CPU kthread > workers already when they are created. It makes the life easier. > kthread_bind() could not be used later for an already running worker. > > This patch does _not_ convert existing kthread workers. The kthread worker > API need more improvements first, e.g. a function to destroy the worker. > > IMPORTANT: > > kthread_create_worker_on_cpu() allows to use any format of the > worker name, in compare with kthread_create_on_cpu(). The good thing > is that it is more generic. The bad thing is that most users will > need to pass the cpu number in two parameters, e.g. > kthread_create_worker_on_cpu(cpu, "helper/%d", cpu). > > To be honest, the main motivation was to avoid the need for an > empty va_list. The only legal way was to create a helper function that > would be called with an empty list. Other attempts caused compilation > warnings or even errors on different architectures. > > There were also other alternatives, for example, using #define or > splitting __kthread_create_worker(). The used solution looked > like the least ugly. > > Signed-off-by: Petr Mladek <pmladek@suse.com> Acked-by: Tejun Heo <tj@kernel.org> Thanks. -- tejun
Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread
[PATCH v9 05/12] kthread: Add kthread_create_worker*() Petr Mladek <pmladek@suse.com> - 2016-06-16 13:20 +0200 Re: [PATCH v9 05/12] kthread: Add kthread_create_worker*() Tejun Heo <tj@kernel.org> - 2016-06-20 22:00 +0200
csiph-web