[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20130619084124.GF30681@mtj.dyndns.org>
Date: Wed, 19 Jun 2013 01:41:24 -0700
From: Tejun Heo <tj@...nel.org>
To: Chen Gang <gang.chen@...anux.com>
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 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 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