Commit 7ccc2151 authored by Wenchao Hao's avatar Wenchao Hao Committed by Tejun Heo
Browse files

workqueue: Clean code in alloc_and_link_pwqs()



wq->flags would not change, so it's not necessary to check if WQ_BH
is set in loop for_each_possible_cpu(), move define and set of pools
out of loop to simpliy the code.

Signed-off-by: default avatarWenchao Hao <haowenchao22@gmail.com>
Signed-off-by: default avatarTejun Heo <tj@kernel.org>
parent 8a929806
Loading
Loading
Loading
Loading
+7 −6
Original line number Diff line number Diff line
@@ -5461,16 +5461,17 @@ static int alloc_and_link_pwqs(struct workqueue_struct *wq)
		goto enomem;

	if (!(wq->flags & WQ_UNBOUND)) {
		for_each_possible_cpu(cpu) {
			struct pool_workqueue **pwq_p;
		struct worker_pool __percpu *pools;
			struct worker_pool *pool;

		if (wq->flags & WQ_BH)
			pools = bh_worker_pools;
		else
			pools = cpu_worker_pools;

		for_each_possible_cpu(cpu) {
			struct pool_workqueue **pwq_p;
			struct worker_pool *pool;

			pool = &(per_cpu_ptr(pools, cpu)[highpri]);
			pwq_p = per_cpu_ptr(wq->cpu_pwq, cpu);