Re: [PATCH v3 07/22] kthread: Detect when a kthread work is used by more workers

From: Tejun Heo
Date: Mon Nov 23 2015 - 17:27:14 EST


Hello,

On Wed, Nov 18, 2015 at 02:25:12PM +0100, Petr Mladek wrote:
> @@ -610,6 +625,12 @@ repeat:
> if (work) {
> __set_current_state(TASK_RUNNING);
> work->func(work);
> +
> + spin_lock_irq(&worker->lock);
> + /* Allow to queue the work into another worker */
> + if (!kthread_work_pending(work))
> + work->worker = NULL;
> + spin_unlock_irq(&worker->lock);

Doesn't this mean that the work item can't be freed from its callback?
That pattern tends to happen regularly.

Thanks.

--
tejun
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/