On Wed, Jun 19, 2013 at 12:03:38PM +0800, Chen Gang wrote: > > Since "WARN_ON(worker->task)", we can not assume that 'worker->task' > will be NULL before set 'current' to it. > > So need let 'worker' lock protected too, just like it already lock > protected all time in main looping.
That synchronization is the kthread_worker user's responsibility. The locking around worker->task = NULL is to prevent the worker task being destroyed while insert_kthread_work() is trying to wake it up. It has nothing to do with the user trying to attach multiple tasks to the same kthread_worker. Plus, putting locking around WARN_ON() is pointless. It doesn't really fix anything. It just makes WARN_ON() trigger *slightly* more reliably. Thanks. -- tejun -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/