[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20160620201002.GZ3262@mtj.duckdns.org>
Date: Mon, 20 Jun 2016 16:10:02 -0400
From: Tejun Heo <tj@...nel.org>
To: Petr Mladek <pmladek@...e.com>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
Oleg Nesterov <oleg@...hat.com>,
Ingo Molnar <mingo@...hat.com>,
Peter Zijlstra <peterz@...radead.org>,
Steven Rostedt <rostedt@...dmis.org>,
"Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>,
Josh Triplett <josh@...htriplett.org>,
Thomas Gleixner <tglx@...utronix.de>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Jiri Kosina <jkosina@...e.cz>, Borislav Petkov <bp@...e.de>,
Michal Hocko <mhocko@...e.cz>, linux-mm@...ck.org,
Vlastimil Babka <vbabka@...e.cz>, linux-api@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v9 08/12] kthread: Detect when a kthread work is used by
more workers
Hello,
On Thu, Jun 16, 2016 at 01:17:27PM +0200, Petr Mladek wrote:
> diff --git a/kernel/kthread.c b/kernel/kthread.c
> index 567ec49b4872..8e9548649c86 100644
> --- a/kernel/kthread.c
> +++ b/kernel/kthread.c
> @@ -574,6 +574,9 @@ EXPORT_SYMBOL_GPL(__kthread_init_worker);
> * The works are not allowed to keep any locks, disable preemption or interrupts
> * when they finish. There is defined a safe point for freezing when one work
> * finishes and before a new one is started.
> + *
> + * Also the works must not be handled by more workers at the same time, see also
^
than one
> + * kthread_queue_work().
> */
> int kthread_worker_fn(void *worker_ptr)
> {
> @@ -710,12 +713,21 @@ kthread_create_worker_on_cpu(int cpu, const char namefmt[], ...)
> }
> EXPORT_SYMBOL(kthread_create_worker_on_cpu);
>
> +static void kthread_insert_work_sanity_check(struct kthread_worker *worker,
> + struct kthread_work *work)
> +{
> + lockdep_assert_held(&worker->lock);
> + WARN_ON_ONCE(!list_empty(&work->node));
> + /* Do not use a work with more workers, see kthread_queue_work() */
^
ditto, maybe just say ">1 workers"?
Looks good otherwise.
Thanks.
--
tejun
Powered by blists - more mailing lists