Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 36576000 authored by Joonsoo Kim's avatar Joonsoo Kim Committed by Tejun Heo
Browse files

workqueue: add WARN_ON_ONCE() on CPU number to wq_worker_waking_up()



Recently, workqueue code has gone through some changes and we found
some bugs related to concurrency management operations happening on
the wrong CPU.  When a worker is concurrency managed
(!WORKER_NOT_RUNNIG), it should be bound to its associated cpu and
woken up to that cpu.  Add WARN_ON_ONCE() to verify this.

Signed-off-by: default avatarJoonsoo Kim <js1304@gmail.com>
Signed-off-by: default avatarTejun Heo <tj@kernel.org>
parent 999767be
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -739,9 +739,11 @@ 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));
	}
}

/**
 * wq_worker_sleeping - a worker is going to sleep