[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <51C18540.5060200@asianux.com>
Date: Wed, 19 Jun 2013 18:17:36 +0800
From: Chen Gang <gang.chen@...anux.com>
To: Tejun Heo <tj@...nel.org>
CC: Thomas Gleixner <tglx@...utronix.de>,
Oleg Nesterov <oleg@...hat.com>, laijs@...fujitsu.com,
Andrew Morton <akpm@...ux-foundation.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] kernel/kthread.c: need spin_lock_irq() for 'worker' before
main looping, since it can "WARN_ON(worker->task)".
On 06/19/2013 04:41 PM, Tejun Heo wrote:
> 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.
Hmm... can 'worker->task' has chance to be not NULL before set 'current'
to it ?
why do we use WARN_ON(worker->task) ?
I guess it still has chance to let "worker->task != NULL", or it should
be BUG_ON(worker->task) instead of.
Thanks.
--
Chen Gang
Asianux Corporation
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists