Skip to contentSkip to conversation

workqueue: insert warn_on_once() into wq_worker_waking_up()

PATCH Applied Joonsoo Kim 2 participants 2 messages Oct 26, 2012 Workqueue

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 workqueue: insert warn_on_once() into wq_worker_waking_up()

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.

kernel/workqueue.c +3 -1
index a1135c6..1a65132 100644
@@ -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));
+	}
 }
 
 /**
Signature · 1 line
1.7.9.5
maintainer Applied
#1 lore raw
Quoted 7 lines · 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.

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

Thanks.

Signature · 1 line
tejun