linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] workqueue: insert warn_on_once() into wq_worker_waking_up()
@ 2012-10-26 14:03 Joonsoo Kim
  2012-10-26 14:48 ` Tejun Heo
  0 siblings, 1 reply; 2+ messages in thread
From: Joonsoo Kim @ 2012-10-26 14:03 UTC (permalink / raw)
  To: Tejun Heo; +Cc: linux-kernel, Joonsoo Kim

Recently, workqueue code has gone through some changes and we found some bugs
related to this. To prevent futher bugs in advance, add WARN_ON_ONCE() in
wq_worker_waking_up(). When worker is not WORKER_NOT_RUNNIG state,
it should be binded to it's associated cpu and executed in that cpu.
Add code for checking this.

Signed-off-by: Joonsoo Kim <js1304@gmail.com>

diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index a1135c6..1a65132 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -739,8 +739,10 @@ void wq_worker_waking_up(struct task_struct *task, unsigned int cpu)
 {
 	struct worker *worker = kthread_data(task);
 
-	if (!(worker->flags & WORKER_NOT_RUNNING))
+	if (!(worker->flags & WORKER_NOT_RUNNING)) {
+		WARN_ON_ONCE(worker->pool->gcwq->cpu != cpu);
 		atomic_inc(get_pool_nr_running(worker->pool));
+	}
 }
 
 /**
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] workqueue: insert warn_on_once() into wq_worker_waking_up()
  2012-10-26 14:03 [PATCH] workqueue: insert warn_on_once() into wq_worker_waking_up() Joonsoo Kim
@ 2012-10-26 14:48 ` Tejun Heo
  0 siblings, 0 replies; 2+ messages in thread
From: Tejun Heo @ 2012-10-26 14:48 UTC (permalink / raw)
  To: Joonsoo Kim; +Cc: linux-kernel

On Fri, Oct 26, 2012 at 11:03:49PM +0900, Joonsoo Kim wrote:
> Recently, workqueue code has gone through some changes and we found some bugs
> related to this. To prevent futher bugs in advance, add WARN_ON_ONCE() in
> wq_worker_waking_up(). When worker is not WORKER_NOT_RUNNIG state,
> it should be binded to it's associated cpu and executed in that cpu.
> Add code for checking this.
> 
> Signed-off-by: Joonsoo Kim <js1304@gmail.com>

Applied to wq/for-3.8 w/ some commit message updates.

Thanks.

-- 
tejun

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-10-26 14:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-10-26 14:03 [PATCH] workqueue: insert warn_on_once() into wq_worker_waking_up() Joonsoo Kim
2012-10-26 14:48 ` Tejun Heo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).