Skip to content

Commit 7ccc215

Browse files
haowenchaohtejun
authored andcommitted
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: Wenchao Hao <[email protected]> Signed-off-by: Tejun Heo <[email protected]>
1 parent 8a92980 commit 7ccc215

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

kernel/workqueue.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5461,16 +5461,17 @@ static int alloc_and_link_pwqs(struct workqueue_struct *wq)
54615461
goto enomem;
54625462

54635463
if (!(wq->flags & WQ_UNBOUND)) {
5464+
struct worker_pool __percpu *pools;
5465+
5466+
if (wq->flags & WQ_BH)
5467+
pools = bh_worker_pools;
5468+
else
5469+
pools = cpu_worker_pools;
5470+
54645471
for_each_possible_cpu(cpu) {
54655472
struct pool_workqueue **pwq_p;
5466-
struct worker_pool __percpu *pools;
54675473
struct worker_pool *pool;
54685474

5469-
if (wq->flags & WQ_BH)
5470-
pools = bh_worker_pools;
5471-
else
5472-
pools = cpu_worker_pools;
5473-
54745475
pool = &(per_cpu_ptr(pools, cpu)[highpri]);
54755476
pwq_p = per_cpu_ptr(wq->cpu_pwq, cpu);
54765477

0 commit comments

Comments
 (0)