Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1419819

Re: [PATCH v8 02/12] kthread: Kthread worker API cleanup

From Andrew Morton <akpm@linux-foundation.org>
Newsgroups linux.kernel
Subject Re: [PATCH v8 02/12] kthread: Kthread worker API cleanup
Date 2016-06-11 00:30 +0200
Message-ID <rID6b-2Ul-39@gated-at.bofh.it> (permalink)
References <rI8F3-78c-3@gated-at.bofh.it> <rI8F4-78c-27@gated-at.bofh.it> <rI9KO-82L-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Thu, 9 Jun 2016 11:07:10 -0400 Steven Rostedt <rostedt@goodmis.org> wrote:

> On Thu,  9 Jun 2016 15:51:56 +0200
> Petr Mladek <pmladek@suse.com> wrote:
> 
> > A good practice is to prefix the names of functions and macros
> > by the name of the subsystem.
> > 
> > The kthread worker API is a mix of classic kthreads and workqueues.
> > Each worker has a dedicated kthread. It runs a generic function
> > that process queued works. It is implemented as part of
> > the kthread subsystem.
> > 
> > This patch renames the existing kthread worker API to use
> > the corresponding name from the workqueues API prefixed by
> > kthread_/KTHREAD_:
> > 
> > DEFINE_KTHREAD_WORKER()		-> KTHREAD_DECLARE_WORKER()
> > DEFINE_KTHREAD_WORK()		-> KTHREAD_DECLARE_WORK()
> > DEFINE_KTHREAD_WORKER_ONSTACK()	-> KTHREAD_DECLARE_WORKER_ONSTACK()
> > DEFINE_KTHREAD_WORKER_ONSTACK()	-> KTHREAD_DECLARE_WORKER_ONSTACK()
> > __init_kthread_worker()		-> __kthread_init_worker()
> > init_kthread_worker()		-> kthread_init_worker()
> > init_kthread_work()		-> kthread_init_work()
> > insert_kthread_work()		-> kthread_insert_work()
> > queue_kthread_work()		-> kthread_queue_work()
> > flush_kthread_work()		-> kthread_flush_work()
> > flush_kthread_worker()		-> kthread_flush_worker()
> > 
> 
> I know that Andrew suggested this, but I didn't get a chance to respond
> to his email due to traveling.
> 
> Does this mean we are going to change all APIs like this? Because we
> pretty much use this type of naming everywhere. That is, we start with
> "DEFINE_*" and "DECLARE_*" commonly. As well as "init_*".
> 
> For example DEFINE_PER_CPU(), DEFINE_SPINLOCK(), DEFINE_LGLOCK(),
> DEFINE_MUTEX(), DEFINE_RES_MEME(), DEFINE_TIMER(), DEFINE_IDA(),
> DEFINE_NFS4_*(), and the list goes on. Just do a grep in
> include/linux/*.h for DEFINE_ and DECLARE_.

Yes, there's so much precedence that DEFINE_KTHREAD_WORKER() and
friends can/should be left as-is.

But I do think that init_kthread_worker() is a sore thumb and should
become kthread_worker_init() (not kthread_worker_init())

> Also, are you sure that we should change the DEFINE to a DECLARE,
> because DEFINE is used to create the object in question, DECLARE is for
> header files:

Yes2, these macros expand to definitions, not to declarations.

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v8 00/12] kthread: Kthread worker API improvements Petr Mladek <pmladek@suse.com> - 2016-06-09 16:00 +0200
  [PATCH v8 02/12] kthread: Kthread worker API cleanup Petr Mladek <pmladek@suse.com> - 2016-06-09 16:00 +0200
    Re: [PATCH v8 02/12] kthread: Kthread worker API cleanup Steven Rostedt <rostedt@goodmis.org> - 2016-06-09 17:10 +0200
      Re: [PATCH v8 02/12] kthread: Kthread worker API cleanup Andrew Morton <akpm@linux-foundation.org> - 2016-06-11 00:30 +0200
        Re: [PATCH v8 02/12] kthread: Kthread worker API cleanup Petr Mladek <pmladek@suse.com> - 2016-06-13 17:20 +0200
          Re: [PATCH v8 02/12] kthread: Kthread worker API cleanup Steven Rostedt <rostedt@goodmis.org> - 2016-06-13 18:10 +0200
    Re: [PATCH v8 02/12] kthread: Kthread worker API cleanup Peter Zijlstra <peterz@infradead.org> - 2016-06-09 19:30 +0200
  [PATCH v8 06/12] kthread: Add kthread_drain_worker() Petr Mladek <pmladek@suse.com> - 2016-06-09 16:00 +0200

csiph-web