From: Chen Gang <gang.chen@asianux.com>
To: Tejun Heo <tj@kernel.org>
Cc: Thomas Gleixner <tglx@linutronix.de>,
Oleg Nesterov <oleg@redhat.com>,
laijs@cn.fujitsu.com, Andrew Morton <akpm@linux-foundation.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] kernel/kthread.c: need spin_lock_irq() for 'worker' before main looping, since it can "WARN_ON(worker->task)".
Date: Wed, 19 Jun 2013 18:17:36 +0800 [thread overview]
Message-ID: <51C18540.5060200@asianux.com> (raw)
In-Reply-To: <20130619084124.GF30681@mtj.dyndns.org>
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
next prev parent reply other threads:[~2013-06-19 10:18 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-19 4:03 [PATCH] kernel/kthread.c: need spin_lock_irq() for 'worker' before main looping, since it can "WARN_ON(worker->task)" Chen Gang
2013-06-19 8:41 ` Tejun Heo
2013-06-19 10:17 ` Chen Gang [this message]
2013-06-19 15:52 ` Tejun Heo
2013-06-20 1:53 ` Chen Gang
2013-06-20 7:02 ` Thomas Gleixner
2013-06-20 7:37 ` Chen Gang
2013-06-20 8:28 ` Thomas Gleixner
2013-06-20 9:36 ` Chen Gang
2013-06-19 8:43 ` Thomas Gleixner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=51C18540.5060200@asianux.com \
--to=gang.chen@asianux.com \
--cc=akpm@linux-foundation.org \
--cc=laijs@cn.fujitsu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=oleg@redhat.com \
--cc=tglx@linutronix.de \
--cc=tj@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox