Re: [PATCH v9 08/12] kthread: Detect when a kthread work is used by more workers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]