History

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.

Wenchao Hao committed 2 years ago

Commit 7ccc2151 parent 8a929801 file · +7 −6Browse files

Showing the changes to kernel/workqueue.c (1 of 1 file). Show all

Unified · Split

kernel/workqueue.c+7−6
@@ -5461,16 +5461,17 @@ static int alloc_and_link_pwqs(struct workqueue_struct *wq) · 5460 unmodified lines
5461 goto enomem;5461 goto enomem;
5462 5462
5463 if (!(wq->flags & WQ_UNBOUND)) {5463 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
5464 for_each_possible_cpu(cpu) {5471 for_each_possible_cpu(cpu) {
5465 struct pool_workqueue **pwq_p;5472 struct pool_workqueue **pwq_p;
5466 struct worker_pool __percpu *pools;
5467 struct worker_pool *pool;5473 struct worker_pool *pool;
5468 5474
5469 if (wq->flags & WQ_BH)
5470 pools = bh_worker_pools;
5471 else
5472 pools = cpu_worker_pools;
5473
5474 pool = &(per_cpu_ptr(pools, cpu)[highpri]);5475 pool = &(per_cpu_ptr(pools, cpu)[highpri]);
5475 pwq_p = per_cpu_ptr(wq->cpu_pwq, cpu);5476 pwq_p = per_cpu_ptr(wq->cpu_pwq, cpu);
5476 5477

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t