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
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

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