History

workqueue: rename cpu_workqueue to pool_workqueue

workqueue has moved away from global_cwqs to worker_pools and with the scheduled custom worker pools, wforkqueues will be associated with pools which don't have anything to do with CPUs. The workqueue code went through significant amount of changes recently and mass renaming isn't likely to hurt much additionally. Let's replace 'cpu' with 'pool' so that it reflects the current design. * s/struct cpu_workqueue_struct/struct pool_workqueue/ * s/cpu_wq/pool_wq/ * s/cwq/pwq/ This patch is purely cosmetic.

Tejun Heo committed 13 years ago

Commit 112202d1 parent 8d03ecf4 files · +228 −229Browse files

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

Unified · Split

kernel/workqueue.c+216−217
@@ -154,11 +154,12 @@ struct worker_pool { · 153 unmodified lines
154154 } ____cacheline_aligned_in_smp;
155155
156156 /*
157− * The per-CPU workqueue. The lower WORK_STRUCT_FLAG_BITS of
158− * work_struct->data are used for flags and thus cwqs need to be
159− * aligned at two's power of the number of flag bits.
157+ * The per-pool workqueue. While queued, the lower WORK_STRUCT_FLAG_BITS
158+ * of work_struct->data are used for flags and the remaining high bits
159+ * point to the pwq; thus, pwqs need to be aligned at two's power of the
160+ * number of flag bits.
160161 */
161−struct cpu_workqueue_struct {
162+struct pool_workqueue {
162163 struct worker_pool *pool; /* I: the associated pool */
163164 struct workqueue_struct *wq; /* I: the owning workqueue */
164165 int work_color; /* L: current color */
@@ -207,16 +208,16 @@ typedef unsigned long mayday_mask_t; · 42 unmodified lines
207208 struct workqueue_struct {
208209 unsigned int flags; /* W: WQ_* flags */
209210 union {
210− struct cpu_workqueue_struct __percpu *pcpu;
211− struct cpu_workqueue_struct *single;
211+ struct pool_workqueue __percpu *pcpu;
212+ struct pool_workqueue *single;
212213 unsigned long v;
213− } cpu_wq; /* I: cwq's */
214+ } pool_wq; /* I: pwq's */
214215 struct list_head list; /* W: list of all workqueues */
215216
216217 struct mutex flush_mutex; /* protects wq flushing */
217218 int work_color; /* F: current work color */
218219 int flush_color; /* F: current flush color */
219− atomic_t nr_cwqs_to_flush; /* flush in progress */
220+ atomic_t nr_pwqs_to_flush; /* flush in progress */
220221 struct wq_flusher *first_flusher; /* F: first flusher */
221222 struct list_head flusher_queue; /* F: flush waiters */
222223 struct list_head flusher_overflow; /* F: flush overflow list */
@@ -225,7 +226,7 @@ struct workqueue_struct { · 2 unmodified lines
225226 struct worker *rescuer; /* I: rescue worker */
226227
227228 int nr_drainers; /* W: drain in progress */
228− int saved_max_active; /* W: saved cwq max_active */
229+ int saved_max_active; /* W: saved pwq max_active */
229230 #ifdef CONFIG_LOCKDEP
230231 struct lockdep_map lockdep_map;
231232 #endif
@@ -268,7 +269,7 @@ static inline int __next_wq_cpu(int cpu, const struct cpumask *mask, · 36 unmodified lines
268269 return WORK_CPU_END;
269270 }
270271
271−static inline int __next_cwq_cpu(int cpu, const struct cpumask *mask,
272+static inline int __next_pwq_cpu(int cpu, const struct cpumask *mask,
272273 struct workqueue_struct *wq)
273274 {
274275 return __next_wq_cpu(cpu, mask, !(wq->flags & WQ_UNBOUND) ? 1 : 2);
@@ -284,7 +285,7 @@ static inline int __next_cwq_cpu(int cpu, const struct cpumask *mask, · 9 unmodified lines
284285 *
285286 * for_each_wq_cpu() : possible CPUs + WORK_CPU_UNBOUND
286287 * for_each_online_wq_cpu() : online CPUs + WORK_CPU_UNBOUND
287− * for_each_cwq_cpu() : possible CPUs for bound workqueues,
288+ * for_each_pwq_cpu() : possible CPUs for bound workqueues,
288289 * WORK_CPU_UNBOUND for unbound workqueues
289290 */
290291 #define for_each_wq_cpu(cpu) \
@@ -297,10 +298,10 @@ static inline int __next_cwq_cpu(int cpu, const struct cpumask *mask, · 6 unmodified lines
297298 (cpu) < WORK_CPU_END; \
298299 (cpu) = __next_wq_cpu((cpu), cpu_online_mask, 3))
299300
300−#define for_each_cwq_cpu(cpu, wq) \
301− for ((cpu) = __next_cwq_cpu(-1, cpu_possible_mask, (wq)); \
301+#define for_each_pwq_cpu(cpu, wq) \
302+ for ((cpu) = __next_pwq_cpu(-1, cpu_possible_mask, (wq)); \
302303 (cpu) < WORK_CPU_END; \
303− (cpu) = __next_cwq_cpu((cpu), cpu_possible_mask, (wq)))
304+ (cpu) = __next_pwq_cpu((cpu), cpu_possible_mask, (wq)))
304305
305306 #ifdef CONFIG_DEBUG_OBJECTS_WORK
306307
@@ -479,14 +480,14 @@ static struct worker_pool *get_std_worker_pool(int cpu, bool highpri) · 172 unmodified lines
479480 return &pools[highpri];
480481 }
481482
482−static struct cpu_workqueue_struct *get_cwq(unsigned int cpu,
483− struct workqueue_struct *wq)
483+static struct pool_workqueue *get_pwq(unsigned int cpu,
484+ struct workqueue_struct *wq)
484485 {
485486 if (!(wq->flags & WQ_UNBOUND)) {
486487 if (likely(cpu < nr_cpu_ids))
487− return per_cpu_ptr(wq->cpu_wq.pcpu, cpu);
488+ return per_cpu_ptr(wq->pool_wq.pcpu, cpu);
488489 } else if (likely(cpu == WORK_CPU_UNBOUND))
489− return wq->cpu_wq.single;
490+ return wq->pool_wq.single;
490491 return NULL;
491492 }
492493
@@ -507,18 +508,18 @@ static int work_next_color(int color) · 14 unmodified lines
507508 }
508509
509510 /*
510− * While queued, %WORK_STRUCT_CWQ is set and non flag bits of a work's data
511− * contain the pointer to the queued cwq. Once execution starts, the flag
511+ * While queued, %WORK_STRUCT_PWQ is set and non flag bits of a work's data
512+ * contain the pointer to the queued pwq. Once execution starts, the flag
512513 * is cleared and the high bits contain OFFQ flags and pool ID.
513514 *
514− * set_work_cwq(), set_work_pool_and_clear_pending(), mark_work_canceling()
515− * and clear_work_data() can be used to set the cwq, pool or clear
515+ * set_work_pwq(), set_work_pool_and_clear_pending(), mark_work_canceling()
516+ * and clear_work_data() can be used to set the pwq, pool or clear
516517 * work->data. These functions should only be called while the work is
517518 * owned - ie. while the PENDING bit is set.
518519 *
519− * get_work_pool() and get_work_cwq() can be used to obtain the pool or cwq
520+ * get_work_pool() and get_work_pwq() can be used to obtain the pool or pwq
520521 * corresponding to a work. Pool is available once the work has been
521− * queued anywhere after initialization until it is sync canceled. cwq is
522+ * queued anywhere after initialization until it is sync canceled. pwq is
522523 * available only while the work item is queued.
523524 *
524525 * %WORK_OFFQ_CANCELING is used to mark a work item which is being
@@ -533,12 +534,11 @@ static inline void set_work_data(struct work_struct *work, unsigned long data, · 8 unmodified lines
533534 atomic_long_set(&work->data, data | flags | work_static(work));
534535 }
535536
536−static void set_work_cwq(struct work_struct *work,
537− struct cpu_workqueue_struct *cwq,
537+static void set_work_pwq(struct work_struct *work, struct pool_workqueue *pwq,
538538 unsigned long extra_flags)
539539 {
540− set_work_data(work, (unsigned long)cwq,
541− WORK_STRUCT_PENDING | WORK_STRUCT_CWQ | extra_flags);
540+ set_work_data(work, (unsigned long)pwq,
541+ WORK_STRUCT_PENDING | WORK_STRUCT_PWQ | extra_flags);
542542 }
543543
544544 static void set_work_pool_and_keep_pending(struct work_struct *work,
@@ -567,11 +567,11 @@ static void clear_work_data(struct work_struct *work) · 22 unmodified lines
567567 set_work_data(work, WORK_STRUCT_NO_POOL, 0);
568568 }
569569
570−static struct cpu_workqueue_struct *get_work_cwq(struct work_struct *work)
570+static struct pool_workqueue *get_work_pwq(struct work_struct *work)
571571 {
572572 unsigned long data = atomic_long_read(&work->data);
573573
574− if (data & WORK_STRUCT_CWQ)
574+ if (data & WORK_STRUCT_PWQ)
575575 return (void *)(data & WORK_STRUCT_WQ_DATA_MASK);
576576 else
577577 return NULL;
@@ -589,8 +589,8 @@ static struct worker_pool *get_work_pool(struct work_struct *work) · 11 unmodified lines
589589 struct worker_pool *pool;
590590 int pool_id;
591591
592− if (data & WORK_STRUCT_CWQ)
593− return ((struct cpu_workqueue_struct *)
592+ if (data & WORK_STRUCT_PWQ)
593+ return ((struct pool_workqueue *)
594594 (data & WORK_STRUCT_WQ_DATA_MASK))->pool;
595595
596596 pool_id = data >> WORK_OFFQ_POOL_SHIFT;
@@ -613,8 +613,8 @@ static int get_work_pool_id(struct work_struct *work) · 16 unmodified lines
613613 {
614614 unsigned long data = atomic_long_read(&work->data);
615615
616− if (data & WORK_STRUCT_CWQ)
617− return ((struct cpu_workqueue_struct *)
616+ if (data & WORK_STRUCT_PWQ)
617+ return ((struct pool_workqueue *)
618618 (data & WORK_STRUCT_WQ_DATA_MASK))->pool->id;
619619
620620 return data >> WORK_OFFQ_POOL_SHIFT;
@@ -632,7 +632,7 @@ static bool work_is_canceling(struct work_struct *work) · 11 unmodified lines
632632 {
633633 unsigned long data = atomic_long_read(&work->data);
634634
635− return !(data & WORK_STRUCT_CWQ) && (data & WORK_OFFQ_CANCELING);
635+ return !(data & WORK_STRUCT_PWQ) && (data & WORK_OFFQ_CANCELING);
636636 }
637637
638638 /*
@@ -961,67 +961,67 @@ static void move_linked_works(struct work_struct *work, struct list_head *head, · 322 unmodified lines
961961 *nextp = n;
962962 }
963963
964−static void cwq_activate_delayed_work(struct work_struct *work)
964+static void pwq_activate_delayed_work(struct work_struct *work)
965965 {
966− struct cpu_workqueue_struct *cwq = get_work_cwq(work);
966+ struct pool_workqueue *pwq = get_work_pwq(work);
967967
968968 trace_workqueue_activate_work(work);
969− move_linked_works(work, &cwq->pool->worklist, NULL);
969+ move_linked_works(work, &pwq->pool->worklist, NULL);
970970 __clear_bit(WORK_STRUCT_DELAYED_BIT, work_data_bits(work));
971− cwq->nr_active++;
971+ pwq->nr_active++;
972972 }
973973
974−static void cwq_activate_first_delayed(struct cpu_workqueue_struct *cwq)
974+static void pwq_activate_first_delayed(struct pool_workqueue *pwq)
975975 {
976− struct work_struct *work = list_first_entry(&cwq->delayed_works,
976+ struct work_struct *work = list_first_entry(&pwq->delayed_works,
977977 struct work_struct, entry);
978978
979− cwq_activate_delayed_work(work);
979+ pwq_activate_delayed_work(work);
980980 }
981981
982982 /**
983− * cwq_dec_nr_in_flight - decrement cwq's nr_in_flight
984− * @cwq: cwq of interest
983+ * pwq_dec_nr_in_flight - decrement pwq's nr_in_flight
984+ * @pwq: pwq of interest
985985 * @color: color of work which left the queue
986986 *
987987 * A work either has completed or is removed from pending queue,
988− * decrement nr_in_flight of its cwq and handle workqueue flushing.
988+ * decrement nr_in_flight of its pwq and handle workqueue flushing.
989989 *
990990 * CONTEXT:
991991 * spin_lock_irq(pool->lock).
992992 */
993−static void cwq_dec_nr_in_flight(struct cpu_workqueue_struct *cwq, int color)
993+static void pwq_dec_nr_in_flight(struct pool_workqueue *pwq, int color)
994994 {
995995 /* ignore uncolored works */
996996 if (color == WORK_NO_COLOR)
997997 return;
998998
999− cwq->nr_in_flight[color]--;
999+ pwq->nr_in_flight[color]--;
10001000
1001− cwq->nr_active--;
1002− if (!list_empty(&cwq->delayed_works)) {
1001+ pwq->nr_active--;
1002+ if (!list_empty(&pwq->delayed_works)) {
10031003 /* one down, submit a delayed one */
1004− if (cwq->nr_active < cwq->max_active)
1005− cwq_activate_first_delayed(cwq);
1004+ if (pwq->nr_active < pwq->max_active)
1005+ pwq_activate_first_delayed(pwq);
10061006 }
10071007
10081008 /* is flush in progress and are we at the flushing tip? */
1009− if (likely(cwq->flush_color != color))
1009+ if (likely(pwq->flush_color != color))
10101010 return;
10111011
10121012 /* are there still in-flight works? */
1013− if (cwq->nr_in_flight[color])
1013+ if (pwq->nr_in_flight[color])
10141014 return;
10151015
1016− /* this cwq is done, clear flush_color */
1017− cwq->flush_color = -1;
1016+ /* this pwq is done, clear flush_color */
1017+ pwq->flush_color = -1;
10181018
10191019 /*
1020− * If this was the last cwq, wake up the first flusher. It
1020+ * If this was the last pwq, wake up the first flusher. It
10211021 * will handle the rest.
10221022 */
1023− if (atomic_dec_and_test(&cwq->wq->nr_cwqs_to_flush))
1024− complete(&cwq->wq->first_flusher->done);
1023+ if (atomic_dec_and_test(&pwq->wq->nr_pwqs_to_flush))
1024+ complete(&pwq->wq->first_flusher->done);
10251025 }
10261026
10271027 /**
@@ -1053,7 +1053,7 @@ static int try_to_grab_pending(struct work_struct *work, bool is_dwork, · 25 unmodified lines
10531053 unsigned long *flags)
10541054 {
10551055 struct worker_pool *pool;
1056− struct cpu_workqueue_struct *cwq;
1056+ struct pool_workqueue *pwq;
10571057
10581058 local_irq_save(*flags);
10591059
@@ -1084,31 +1084,31 @@ static int try_to_grab_pending(struct work_struct *work, bool is_dwork, · 24 unmodified lines
10841084
10851085 spin_lock(&pool->lock);
10861086 /*
1087− * work->data is guaranteed to point to cwq only while the work
1088− * item is queued on cwq->wq, and both updating work->data to point
1089− * to cwq on queueing and to pool on dequeueing are done under
1090− * cwq->pool->lock. This in turn guarantees that, if work->data
1091− * points to cwq which is associated with a locked pool, the work
1087+ * work->data is guaranteed to point to pwq only while the work
1088+ * item is queued on pwq->wq, and both updating work->data to point
1089+ * to pwq on queueing and to pool on dequeueing are done under
1090+ * pwq->pool->lock. This in turn guarantees that, if work->data
1091+ * points to pwq which is associated with a locked pool, the work
10921092 * item is currently queued on that pool.
10931093 */
1094− cwq = get_work_cwq(work);
1095− if (cwq && cwq->pool == pool) {
1094+ pwq = get_work_pwq(work);
1095+ if (pwq && pwq->pool == pool) {
10961096 debug_work_deactivate(work);
10971097
10981098 /*
10991099 * A delayed work item cannot be grabbed directly because
11001100 * it might have linked NO_COLOR work items which, if left
1101− * on the delayed_list, will confuse cwq->nr_active
1101+ * on the delayed_list, will confuse pwq->nr_active
11021102 * management later on and cause stall. Make sure the work
11031103 * item is activated before grabbing.
11041104 */
11051105 if (*work_data_bits(work) & WORK_STRUCT_DELAYED)
1106− cwq_activate_delayed_work(work);
1106+ pwq_activate_delayed_work(work);
11071107
11081108 list_del_init(&work->entry);
1109− cwq_dec_nr_in_flight(get_work_cwq(work), get_work_color(work));
1109+ pwq_dec_nr_in_flight(get_work_pwq(work), get_work_color(work));
11101110
1111− /* work->data points to cwq iff queued, point to pool */
1111+ /* work->data points to pwq iff queued, point to pool */
11121112 set_work_pool_and_keep_pending(work, pool->id);
11131113
11141114 spin_unlock(&pool->lock);
@@ -1125,25 +1125,24 @@ fail: · 10 unmodified lines
11251125
11261126 /**
11271127 * insert_work - insert a work into a pool
1128− * @cwq: cwq @work belongs to
1128+ * @pwq: pwq @work belongs to
11291129 * @work: work to insert
11301130 * @head: insertion point
11311131 * @extra_flags: extra WORK_STRUCT_* flags to set
11321132 *
1133− * Insert @work which belongs to @cwq after @head. @extra_flags is or'd to
1133+ * Insert @work which belongs to @pwq after @head. @extra_flags is or'd to
11341134 * work_struct flags.
11351135 *
11361136 * CONTEXT:
11371137 * spin_lock_irq(pool->lock).
11381138 */
1139−static void insert_work(struct cpu_workqueue_struct *cwq,
1140− struct work_struct *work, struct list_head *head,
1141− unsigned int extra_flags)
1139+static void insert_work(struct pool_workqueue *pwq, struct work_struct *work,
1140+ struct list_head *head, unsigned int extra_flags)
11421141 {
1143− struct worker_pool *pool = cwq->pool;
1142+ struct worker_pool *pool = pwq->pool;
11441143
11451144 /* we own @work, set data and link */
1146− set_work_cwq(work, cwq, extra_flags);
1145+ set_work_pwq(work, pwq, extra_flags);
11471146 list_add_tail(&work->entry, head);
11481147
11491148 /*
@@ -1170,13 +1169,13 @@ static bool is_chained_work(struct workqueue_struct *wq) · 20 unmodified lines
11701169 * Return %true iff I'm a worker execuing a work item on @wq. If
11711170 * I'm @worker, it's safe to dereference it without locking.
11721171 */
1173− return worker && worker->current_cwq->wq == wq;
1172+ return worker && worker->current_pwq->wq == wq;
11741173 }
11751174
11761175 static void __queue_work(unsigned int cpu, struct workqueue_struct *wq,
11771176 struct work_struct *work)
11781177 {
1179− struct cpu_workqueue_struct *cwq;
1178+ struct pool_workqueue *pwq;
11801179 struct list_head *worklist;
11811180 unsigned int work_flags;
11821181 unsigned int req_cpu = cpu;
@@ -1196,7 +1195,7 @@ static void __queue_work(unsigned int cpu, struct workqueue_struct *wq, · 13 unmodified lines
11961195 WARN_ON_ONCE(!is_chained_work(wq)))
11971196 return;
11981197
1199− /* determine the cwq to use */
1198+ /* determine the pwq to use */
12001199 if (!(wq->flags & WQ_UNBOUND)) {
12011200 struct worker_pool *last_pool;
12021201
@@ -1209,54 +1208,54 @@ static void __queue_work(unsigned int cpu, struct workqueue_struct *wq, · 6 unmodified lines
12091208 * work needs to be queued on that cpu to guarantee
12101209 * non-reentrancy.
12111210 */
1212− cwq = get_cwq(cpu, wq);
1211+ pwq = get_pwq(cpu, wq);
12131212 last_pool = get_work_pool(work);
12141213
1215− if (last_pool && last_pool != cwq->pool) {
1214+ if (last_pool && last_pool != pwq->pool) {
12161215 struct worker *worker;
12171216
12181217 spin_lock(&last_pool->lock);
12191218
12201219 worker = find_worker_executing_work(last_pool, work);
12211220
1222− if (worker && worker->current_cwq->wq == wq) {
1223− cwq = get_cwq(last_pool->cpu, wq);
1221+ if (worker && worker->current_pwq->wq == wq) {
1222+ pwq = get_pwq(last_pool->cpu, wq);
12241223 } else {
12251224 /* meh... not running there, queue here */
12261225 spin_unlock(&last_pool->lock);
1227− spin_lock(&cwq->pool->lock);
1226+ spin_lock(&pwq->pool->lock);
12281227 }
12291228 } else {
1230− spin_lock(&cwq->pool->lock);
1229+ spin_lock(&pwq->pool->lock);
12311230 }
12321231 } else {
1233− cwq = get_cwq(WORK_CPU_UNBOUND, wq);
1234− spin_lock(&cwq->pool->lock);
1232+ pwq = get_pwq(WORK_CPU_UNBOUND, wq);
1233+ spin_lock(&pwq->pool->lock);
12351234 }
12361235
1237− /* cwq determined, queue */
1238− trace_workqueue_queue_work(req_cpu, cwq, work);
1236+ /* pwq determined, queue */
1237+ trace_workqueue_queue_work(req_cpu, pwq, work);
12391238
12401239 if (WARN_ON(!list_empty(&work->entry))) {
1241− spin_unlock(&cwq->pool->lock);
1240+ spin_unlock(&pwq->pool->lock);
12421241 return;
12431242 }
12441243
1245− cwq->nr_in_flight[cwq->work_color]++;
1246− work_flags = work_color_to_flags(cwq->work_color);
1244+ pwq->nr_in_flight[pwq->work_color]++;
1245+ work_flags = work_color_to_flags(pwq->work_color);
12471246
1248− if (likely(cwq->nr_active < cwq->max_active)) {
1247+ if (likely(pwq->nr_active < pwq->max_active)) {
12491248 trace_workqueue_activate_work(work);
1250− cwq->nr_active++;
1251− worklist = &cwq->pool->worklist;
1249+ pwq->nr_active++;
1250+ worklist = &pwq->pool->worklist;
12521251 } else {
12531252 work_flags |= WORK_STRUCT_DELAYED;
1254− worklist = &cwq->delayed_works;
1253+ worklist = &pwq->delayed_works;
12551254 }
12561255
1257− insert_work(cwq, work, worklist, work_flags);
1256+ insert_work(pwq, work, worklist, work_flags);
12581257
1259− spin_unlock(&cwq->pool->lock);
1258+ spin_unlock(&pwq->pool->lock);
12601259 }
12611260
12621261 /**
@@ -1661,14 +1660,14 @@ static void rebind_workers(struct worker_pool *pool) · 398 unmodified lines
16611660
16621661 /*
16631662 * wq doesn't really matter but let's keep @worker->pool
1664− * and @cwq->pool consistent for sanity.
1663+ * and @pwq->pool consistent for sanity.
16651664 */
16661665 if (std_worker_pool_pri(worker->pool))
16671666 wq = system_highpri_wq;
16681667 else
16691668 wq = system_wq;
16701669
1671− insert_work(get_cwq(pool->cpu, wq), rebind_work,
1670+ insert_work(get_pwq(pool->cpu, wq), rebind_work,
16721671 worker->scheduled.next,
16731672 work_color_to_flags(WORK_NO_COLOR));
16741673 }
@@ -1845,15 +1844,15 @@ static void idle_worker_timeout(unsigned long __pool) · 170 unmodified lines
18451844
18461845 static bool send_mayday(struct work_struct *work)
18471846 {
1848− struct cpu_workqueue_struct *cwq = get_work_cwq(work);
1849− struct workqueue_struct *wq = cwq->wq;
1847+ struct pool_workqueue *pwq = get_work_pwq(work);
1848+ struct workqueue_struct *wq = pwq->wq;
18501849 unsigned int cpu;
18511850
18521851 if (!(wq->flags & WQ_RESCUER))
18531852 return false;
18541853
18551854 /* mayday mayday mayday */
1856− cpu = cwq->pool->cpu;
1855+ cpu = pwq->pool->cpu;
18571856 /* WORK_CPU_UNBOUND can't be set in cpumask, use cpu 0 instead */
18581857 if (cpu == WORK_CPU_UNBOUND)
18591858 cpu = 0;
@@ -2082,9 +2081,9 @@ static void process_one_work(struct worker *worker, struct work_struct *work) · 222 unmodified lines
20822081 __releases(&pool->lock)
20832082 __acquires(&pool->lock)
20842083 {
2085− struct cpu_workqueue_struct *cwq = get_work_cwq(work);
2084+ struct pool_workqueue *pwq = get_work_pwq(work);
20862085 struct worker_pool *pool = worker->pool;
2087− bool cpu_intensive = cwq->wq->flags & WQ_CPU_INTENSIVE;
2086+ bool cpu_intensive = pwq->wq->flags & WQ_CPU_INTENSIVE;
20882087 int work_color;
20892088 struct worker *collision;
20902089 #ifdef CONFIG_LOCKDEP
@@ -2125,7 +2124,7 @@ __acquires(&pool->lock) · 34 unmodified lines
21252124 hash_add(pool->busy_hash, &worker->hentry, (unsigned long)work);
21262125 worker->current_work = work;
21272126 worker->current_func = work->func;
2128− worker->current_cwq = cwq;
2127+ worker->current_pwq = pwq;
21292128 work_color = get_work_color(work);
21302129
21312130 list_del_init(&work->entry);
@@ -2154,7 +2153,7 @@ __acquires(&pool->lock) · 22 unmodified lines
21542153
21552154 spin_unlock_irq(&pool->lock);
21562155
2157− lock_map_acquire_read(&cwq->wq->lockdep_map);
2156+ lock_map_acquire_read(&pwq->wq->lockdep_map);
21582157 lock_map_acquire(&lockdep_map);
21592158 trace_workqueue_execute_start(work);
21602159 worker->current_func(work);
@@ -2164,7 +2163,7 @@ __acquires(&pool->lock) · 3 unmodified lines
21642163 */
21652164 trace_workqueue_execute_end(work);
21662165 lock_map_release(&lockdep_map);
2167− lock_map_release(&cwq->wq->lockdep_map);
2166+ lock_map_release(&pwq->wq->lockdep_map);
21682167
21692168 if (unlikely(in_atomic() || lockdep_depth(current) > 0)) {
21702169 pr_err("BUG: workqueue leaked lock or atomic: %s/0x%08x/%d\n"
@@ -2185,8 +2184,8 @@ __acquires(&pool->lock) · 14 unmodified lines
21852184 hash_del(&worker->hentry);
21862185 worker->current_work = NULL;
21872186 worker->current_func = NULL;
2188− worker->current_cwq = NULL;
2189− cwq_dec_nr_in_flight(cwq, work_color);
2187+ worker->current_pwq = NULL;
2188+ pwq_dec_nr_in_flight(pwq, work_color);
21902189 }
21912190
21922191 /**
@@ -2353,8 +2352,8 @@ repeat: · 160 unmodified lines
23532352 */
23542353 for_each_mayday_cpu(cpu, wq->mayday_mask) {
23552354 unsigned int tcpu = is_unbound ? WORK_CPU_UNBOUND : cpu;
2356− struct cpu_workqueue_struct *cwq = get_cwq(tcpu, wq);
2357− struct worker_pool *pool = cwq->pool;
2355+ struct pool_workqueue *pwq = get_pwq(tcpu, wq);
2356+ struct worker_pool *pool = pwq->pool;
23582357 struct work_struct *work, *n;
23592358
23602359 __set_current_state(TASK_RUNNING);
@@ -2370,7 +2369,7 @@ repeat: · 9 unmodified lines
23702369 */
23712370 BUG_ON(!list_empty(&rescuer->scheduled));
23722371 list_for_each_entry_safe(work, n, &pool->worklist, entry)
2373− if (get_work_cwq(work) == cwq)
2372+ if (get_work_pwq(work) == pwq)
23742373 move_linked_works(work, scheduled, &n);
23752374
23762375 process_scheduled_works(rescuer);
@@ -2405,7 +2404,7 @@ static void wq_barrier_func(struct work_struct *work) · 28 unmodified lines
24052404
24062405 /**
24072406 * insert_wq_barrier - insert a barrier work
2408− * @cwq: cwq to insert barrier into
2407+ * @pwq: pwq to insert barrier into
24092408 * @barr: wq_barrier to insert
24102409 * @target: target work to attach @barr to
24112410 * @worker: worker currently executing @target, NULL if @target is not executing
@@ -2422,12 +2421,12 @@ static void wq_barrier_func(struct work_struct *work) · 10 unmodified lines
24222421 * after a work with LINKED flag set.
24232422 *
24242423 * Note that when @worker is non-NULL, @target may be modified
2425− * underneath us, so we can't reliably determine cwq from @target.
2424+ * underneath us, so we can't reliably determine pwq from @target.
24262425 *
24272426 * CONTEXT:
24282427 * spin_lock_irq(pool->lock).
24292428 */
2430−static void insert_wq_barrier(struct cpu_workqueue_struct *cwq,
2429+static void insert_wq_barrier(struct pool_workqueue *pwq,
24312430 struct wq_barrier *barr,
24322431 struct work_struct *target, struct worker *worker)
24332432 {
@@ -2460,23 +2459,23 @@ static void insert_wq_barrier(struct cpu_workqueue_struct *cwq, · 26 unmodified lines
24602459 }
24612460
24622461 debug_work_activate(&barr->work);
2463− insert_work(cwq, &barr->work, head,
2462+ insert_work(pwq, &barr->work, head,
24642463 work_color_to_flags(WORK_NO_COLOR) | linked);
24652464 }
24662465
24672466 /**
2468− * flush_workqueue_prep_cwqs - prepare cwqs for workqueue flushing
2467+ * flush_workqueue_prep_pwqs - prepare pwqs for workqueue flushing
24692468 * @wq: workqueue being flushed
24702469 * @flush_color: new flush color, < 0 for no-op
24712470 * @work_color: new work color, < 0 for no-op
24722471 *
2473− * Prepare cwqs for workqueue flushing.
2472+ * Prepare pwqs for workqueue flushing.
24742473 *
2475− * If @flush_color is non-negative, flush_color on all cwqs should be
2476− * -1. If no cwq has in-flight commands at the specified color, all
2477− * cwq->flush_color's stay at -1 and %false is returned. If any cwq
2478− * has in flight commands, its cwq->flush_color is set to
2479− * @flush_color, @wq->nr_cwqs_to_flush is updated accordingly, cwq
2474+ * If @flush_color is non-negative, flush_color on all pwqs should be
2475+ * -1. If no pwq has in-flight commands at the specified color, all
2476+ * pwq->flush_color's stay at -1 and %false is returned. If any pwq
2477+ * has in flight commands, its pwq->flush_color is set to
2478+ * @flush_color, @wq->nr_pwqs_to_flush is updated accordingly, pwq
24802479 * wakeup logic is armed and %true is returned.
24812480 *
24822481 * The caller should have initialized @wq->first_flusher prior to
@@ -2484,7 +2483,7 @@ static void insert_wq_barrier(struct cpu_workqueue_struct *cwq, · 1 unmodified line
24842483 * @flush_color is negative, no flush color update is done and %false
24852484 * is returned.
24862485 *
2487− * If @work_color is non-negative, all cwqs should have the same
2486+ * If @work_color is non-negative, all pwqs should have the same
24882487 * work_color which is previous to @work_color and all will be
24892488 * advanced to @work_color.
24902489 *
@@ -2495,42 +2494,42 @@ static void insert_wq_barrier(struct cpu_workqueue_struct *cwq, · 4 unmodified lines
24952494 * %true if @flush_color >= 0 and there's something to flush. %false
24962495 * otherwise.
24972496 */
2498−static bool flush_workqueue_prep_cwqs(struct workqueue_struct *wq,
2497+static bool flush_workqueue_prep_pwqs(struct workqueue_struct *wq,
24992498 int flush_color, int work_color)
25002499 {
25012500 bool wait = false;
25022501 unsigned int cpu;
25032502
25042503 if (flush_color >= 0) {
2505− BUG_ON(atomic_read(&wq->nr_cwqs_to_flush));
2506− atomic_set(&wq->nr_cwqs_to_flush, 1);
2504+ BUG_ON(atomic_read(&wq->nr_pwqs_to_flush));
2505+ atomic_set(&wq->nr_pwqs_to_flush, 1);
25072506 }
25082507
2509− for_each_cwq_cpu(cpu, wq) {
2510− struct cpu_workqueue_struct *cwq = get_cwq(cpu, wq);
2511− struct worker_pool *pool = cwq->pool;
2508+ for_each_pwq_cpu(cpu, wq) {
2509+ struct pool_workqueue *pwq = get_pwq(cpu, wq);
2510+ struct worker_pool *pool = pwq->pool;
25122511
25132512 spin_lock_irq(&pool->lock);
25142513
25152514 if (flush_color >= 0) {
2516− BUG_ON(cwq->flush_color != -1);
2515+ BUG_ON(pwq->flush_color != -1);
25172516
2518− if (cwq->nr_in_flight[flush_color]) {
2519− cwq->flush_color = flush_color;
2520− atomic_inc(&wq->nr_cwqs_to_flush);
2517+ if (pwq->nr_in_flight[flush_color]) {
2518+ pwq->flush_color = flush_color;
2519+ atomic_inc(&wq->nr_pwqs_to_flush);
25212520 wait = true;
25222521 }
25232522 }
25242523
25252524 if (work_color >= 0) {
2526− BUG_ON(work_color != work_next_color(cwq->work_color));
2527− cwq->work_color = work_color;
2525+ BUG_ON(work_color != work_next_color(pwq->work_color));
2526+ pwq->work_color = work_color;
25282527 }
25292528
25302529 spin_unlock_irq(&pool->lock);
25312530 }
25322531
2533− if (flush_color >= 0 && atomic_dec_and_test(&wq->nr_cwqs_to_flush))
2532+ if (flush_color >= 0 && atomic_dec_and_test(&wq->nr_pwqs_to_flush))
25342533 complete(&wq->first_flusher->done);
25352534
25362535 return wait;
@@ -2581,7 +2580,7 @@ void flush_workqueue(struct workqueue_struct *wq) · 44 unmodified lines
25812580
25822581 wq->first_flusher = &this_flusher;
25832582
2584− if (!flush_workqueue_prep_cwqs(wq, wq->flush_color,
2583+ if (!flush_workqueue_prep_pwqs(wq, wq->flush_color,
25852584 wq->work_color)) {
25862585 /* nothing to flush, done */
25872586 wq->flush_color = next_color;
@@ -2592,7 +2591,7 @@ void flush_workqueue(struct workqueue_struct *wq) · 4 unmodified lines
25922591 /* wait in queue */
25932592 BUG_ON(wq->flush_color == this_flusher.flush_color);
25942593 list_add_tail(&this_flusher.list, &wq->flusher_queue);
2595− flush_workqueue_prep_cwqs(wq, -1, wq->work_color);
2594+ flush_workqueue_prep_pwqs(wq, -1, wq->work_color);
25962595 }
25972596 } else {
25982597 /*
@@ -2659,7 +2658,7 @@ void flush_workqueue(struct workqueue_struct *wq) · 60 unmodified lines
26592658
26602659 list_splice_tail_init(&wq->flusher_overflow,
26612660 &wq->flusher_queue);
2662− flush_workqueue_prep_cwqs(wq, -1, wq->work_color);
2661+ flush_workqueue_prep_pwqs(wq, -1, wq->work_color);
26632662 }
26642663
26652664 if (list_empty(&wq->flusher_queue)) {
@@ -2669,7 +2668,7 @@ void flush_workqueue(struct workqueue_struct *wq) · 3 unmodified lines
26692668
26702669 /*
26712670 * Need to flush more colors. Make the next flusher
2672− * the new first flusher and arm cwqs.
2671+ * the new first flusher and arm pwqs.
26732672 */
26742673 BUG_ON(wq->flush_color == wq->work_color);
26752674 BUG_ON(wq->flush_color != next->flush_color);
@@ -2677,7 +2676,7 @@ void flush_workqueue(struct workqueue_struct *wq) · 1 unmodified line
26772676 list_del_init(&next->list);
26782677 wq->first_flusher = next;
26792678
2680− if (flush_workqueue_prep_cwqs(wq, wq->flush_color, -1))
2679+ if (flush_workqueue_prep_pwqs(wq, wq->flush_color, -1))
26812680 break;
26822681
26832682 /*
@@ -2720,13 +2719,13 @@ void drain_workqueue(struct workqueue_struct *wq) · 36 unmodified lines
27202719 reflush:
27212720 flush_workqueue(wq);
27222721
2723− for_each_cwq_cpu(cpu, wq) {
2724− struct cpu_workqueue_struct *cwq = get_cwq(cpu, wq);
2722+ for_each_pwq_cpu(cpu, wq) {
2723+ struct pool_workqueue *pwq = get_pwq(cpu, wq);
27252724 bool drained;
27262725
2727− spin_lock_irq(&cwq->pool->lock);
2728− drained = !cwq->nr_active && list_empty(&cwq->delayed_works);
2729− spin_unlock_irq(&cwq->pool->lock);
2726+ spin_lock_irq(&pwq->pool->lock);
2727+ drained = !pwq->nr_active && list_empty(&pwq->delayed_works);
2728+ spin_unlock_irq(&pwq->pool->lock);
27302729
27312730 if (drained)
27322731 continue;
@@ -2749,7 +2748,7 @@ static bool start_flush_work(struct work_struct *work, struct wq_barrier *barr) · 16 unmodified lines
27492748 {
27502749 struct worker *worker = NULL;
27512750 struct worker_pool *pool;
2752− struct cpu_workqueue_struct *cwq;
2751+ struct pool_workqueue *pwq;
27532752
27542753 might_sleep();
27552754 pool = get_work_pool(work);
@@ -2758,18 +2757,18 @@ static bool start_flush_work(struct work_struct *work, struct wq_barrier *barr) · 2 unmodified lines
27582757
27592758 spin_lock_irq(&pool->lock);
27602759 /* see the comment in try_to_grab_pending() with the same code */
2761− cwq = get_work_cwq(work);
2762− if (cwq) {
2763− if (unlikely(cwq->pool != pool))
2760+ pwq = get_work_pwq(work);
2761+ if (pwq) {
2762+ if (unlikely(pwq->pool != pool))
27642763 goto already_gone;
27652764 } else {
27662765 worker = find_worker_executing_work(pool, work);
27672766 if (!worker)
27682767 goto already_gone;
2769− cwq = worker->current_cwq;
2768+ pwq = worker->current_pwq;
27702769 }
27712770
2772− insert_wq_barrier(cwq, barr, work, worker);
2771+ insert_wq_barrier(pwq, barr, work, worker);
27732772 spin_unlock_irq(&pool->lock);
27742773
27752774 /*
@@ -2778,11 +2777,11 @@ static bool start_flush_work(struct work_struct *work, struct wq_barrier *barr) · 2 unmodified lines
27782777 * flusher is not running on the same workqueue by verifying write
27792778 * access.
27802779 */
2781− if (cwq->wq->saved_max_active == 1 || cwq->wq->flags & WQ_RESCUER)
2782− lock_map_acquire(&cwq->wq->lockdep_map);
2780+ if (pwq->wq->saved_max_active == 1 || pwq->wq->flags & WQ_RESCUER)
2781+ lock_map_acquire(&pwq->wq->lockdep_map);
27832782 else
2784− lock_map_acquire_read(&cwq->wq->lockdep_map);
2785− lock_map_release(&cwq->wq->lockdep_map);
2783+ lock_map_acquire_read(&pwq->wq->lockdep_map);
2784+ lock_map_release(&pwq->wq->lockdep_map);
27862785
27872786 return true;
27882787 already_gone:
@@ -3092,46 +3091,46 @@ int keventd_up(void) · 303 unmodified lines
30923091 return system_wq != NULL;
30933092 }
30943093
3095−static int alloc_cwqs(struct workqueue_struct *wq)
3094+static int alloc_pwqs(struct workqueue_struct *wq)
30963095 {
30973096 /*
3098− * cwqs are forced aligned according to WORK_STRUCT_FLAG_BITS.
3097+ * pwqs are forced aligned according to WORK_STRUCT_FLAG_BITS.
30993098 * Make sure that the alignment isn't lower than that of
31003099 * unsigned long long.
31013100 */
3102− const size_t size = sizeof(struct cpu_workqueue_struct);
3101+ const size_t size = sizeof(struct pool_workqueue);
31033102 const size_t align = max_t(size_t, 1 << WORK_STRUCT_FLAG_BITS,
31043103 __alignof__(unsigned long long));
31053104
31063105 if (!(wq->flags & WQ_UNBOUND))
3107− wq->cpu_wq.pcpu = __alloc_percpu(size, align);
3106+ wq->pool_wq.pcpu = __alloc_percpu(size, align);
31083107 else {
31093108 void *ptr;
31103109
31113110 /*
3112− * Allocate enough room to align cwq and put an extra
3111+ * Allocate enough room to align pwq and put an extra
31133112 * pointer at the end pointing back to the originally
31143113 * allocated pointer which will be used for free.
31153114 */
31163115 ptr = kzalloc(size + align + sizeof(void *), GFP_KERNEL);
31173116 if (ptr) {
3118− wq->cpu_wq.single = PTR_ALIGN(ptr, align);
3119− *(void **)(wq->cpu_wq.single + 1) = ptr;
3117+ wq->pool_wq.single = PTR_ALIGN(ptr, align);
3118+ *(void **)(wq->pool_wq.single + 1) = ptr;
31203119 }
31213120 }
31223121
31233122 /* just in case, make sure it's actually aligned */
3124− BUG_ON(!IS_ALIGNED(wq->cpu_wq.v, align));
3125− return wq->cpu_wq.v ? 0 : -ENOMEM;
3123+ BUG_ON(!IS_ALIGNED(wq->pool_wq.v, align));
3124+ return wq->pool_wq.v ? 0 : -ENOMEM;
31263125 }
31273126
3128−static void free_cwqs(struct workqueue_struct *wq)
3127+static void free_pwqs(struct workqueue_struct *wq)
31293128 {
31303129 if (!(wq->flags & WQ_UNBOUND))
3131− free_percpu(wq->cpu_wq.pcpu);
3132− else if (wq->cpu_wq.single) {
3133− /* the pointer to free is stored right after the cwq */
3134− kfree(*(void **)(wq->cpu_wq.single + 1));
3130+ free_percpu(wq->pool_wq.pcpu);
3131+ else if (wq->pool_wq.single) {
3132+ /* the pointer to free is stored right after the pwq */
3133+ kfree(*(void **)(wq->pool_wq.single + 1));
31353134 }
31363135 }
31373136
@@ -3185,25 +3184,25 @@ struct workqueue_struct *__alloc_workqueue_key(const char *fmt, · 47 unmodified lines
31853184 wq->flags = flags;
31863185 wq->saved_max_active = max_active;
31873186 mutex_init(&wq->flush_mutex);
3188− atomic_set(&wq->nr_cwqs_to_flush, 0);
3187+ atomic_set(&wq->nr_pwqs_to_flush, 0);
31893188 INIT_LIST_HEAD(&wq->flusher_queue);
31903189 INIT_LIST_HEAD(&wq->flusher_overflow);
31913190
31923191 lockdep_init_map(&wq->lockdep_map, lock_name, key, 0);
31933192 INIT_LIST_HEAD(&wq->list);
31943193
3195− if (alloc_cwqs(wq) < 0)
3194+ if (alloc_pwqs(wq) < 0)
31963195 goto err;
31973196
3198− for_each_cwq_cpu(cpu, wq) {
3199− struct cpu_workqueue_struct *cwq = get_cwq(cpu, wq);
3197+ for_each_pwq_cpu(cpu, wq) {
3198+ struct pool_workqueue *pwq = get_pwq(cpu, wq);
32003199
3201− BUG_ON((unsigned long)cwq & WORK_STRUCT_FLAG_MASK);
3202− cwq->pool = get_std_worker_pool(cpu, flags & WQ_HIGHPRI);
3203− cwq->wq = wq;
3204− cwq->flush_color = -1;
3205− cwq->max_active = max_active;
3206− INIT_LIST_HEAD(&cwq->delayed_works);
3200+ BUG_ON((unsigned long)pwq & WORK_STRUCT_FLAG_MASK);
3201+ pwq->pool = get_std_worker_pool(cpu, flags & WQ_HIGHPRI);
3202+ pwq->wq = wq;
3203+ pwq->flush_color = -1;
3204+ pwq->max_active = max_active;
3205+ INIT_LIST_HEAD(&pwq->delayed_works);
32073206 }
32083207
32093208 if (flags & WQ_RESCUER) {
@@ -3234,8 +3233,8 @@ struct workqueue_struct *__alloc_workqueue_key(const char *fmt, · 24 unmodified lines
32343233 spin_lock(&workqueue_lock);
32353234
32363235 if (workqueue_freezing && wq->flags & WQ_FREEZABLE)
3237− for_each_cwq_cpu(cpu, wq)
3238− get_cwq(cpu, wq)->max_active = 0;
3236+ for_each_pwq_cpu(cpu, wq)
3237+ get_pwq(cpu, wq)->max_active = 0;
32393238
32403239 list_add(&wq->list, &workqueues);
32413240
@@ -3244,7 +3243,7 @@ struct workqueue_struct *__alloc_workqueue_key(const char *fmt, · 2 unmodified lines
32443243 return wq;
32453244 err:
32463245 if (wq) {
3247− free_cwqs(wq);
3246+ free_pwqs(wq);
32483247 free_mayday_mask(wq->mayday_mask);
32493248 kfree(wq->rescuer);
32503249 kfree(wq);
@@ -3275,14 +3274,14 @@ void destroy_workqueue(struct workqueue_struct *wq) · 24 unmodified lines
32753274 spin_unlock(&workqueue_lock);
32763275
32773276 /* sanity check */
3278− for_each_cwq_cpu(cpu, wq) {
3279− struct cpu_workqueue_struct *cwq = get_cwq(cpu, wq);
3277+ for_each_pwq_cpu(cpu, wq) {
3278+ struct pool_workqueue *pwq = get_pwq(cpu, wq);
32803279 int i;
32813280
32823281 for (i = 0; i < WORK_NR_COLORS; i++)
3283− BUG_ON(cwq->nr_in_flight[i]);
3284− BUG_ON(cwq->nr_active);
3285− BUG_ON(!list_empty(&cwq->delayed_works));
3282+ BUG_ON(pwq->nr_in_flight[i]);
3283+ BUG_ON(pwq->nr_active);
3284+ BUG_ON(!list_empty(&pwq->delayed_works));
32863285 }
32873286
32883287 if (wq->flags & WQ_RESCUER) {
@@ -3291,29 +3290,29 @@ void destroy_workqueue(struct workqueue_struct *wq) · 2 unmodified lines
32913290 kfree(wq->rescuer);
32923291 }
32933292
3294− free_cwqs(wq);
3293+ free_pwqs(wq);
32953294 kfree(wq);
32963295 }
32973296 EXPORT_SYMBOL_GPL(destroy_workqueue);
32983297
32993298 /**
3300− * cwq_set_max_active - adjust max_active of a cwq
3301− * @cwq: target cpu_workqueue_struct
3299+ * pwq_set_max_active - adjust max_active of a pwq
3300+ * @pwq: target pool_workqueue
33023301 * @max_active: new max_active value.
33033302 *
3304− * Set @cwq->max_active to @max_active and activate delayed works if
3303+ * Set @pwq->max_active to @max_active and activate delayed works if
33053304 * increased.
33063305 *
33073306 * CONTEXT:
33083307 * spin_lock_irq(pool->lock).
33093308 */
3310−static void cwq_set_max_active(struct cpu_workqueue_struct *cwq, int max_active)
3309+static void pwq_set_max_active(struct pool_workqueue *pwq, int max_active)
33113310 {
3312− cwq->max_active = max_active;
3311+ pwq->max_active = max_active;
33133312
3314− while (!list_empty(&cwq->delayed_works) &&
3315− cwq->nr_active < cwq->max_active)
3316− cwq_activate_first_delayed(cwq);
3313+ while (!list_empty(&pwq->delayed_works) &&
3314+ pwq->nr_active < pwq->max_active)
3315+ pwq_activate_first_delayed(pwq);
33173316 }
33183317
33193318 /**
@@ -3336,15 +3335,15 @@ void workqueue_set_max_active(struct workqueue_struct *wq, int max_active) · 16 unmodified lines
33363335
33373336 wq->saved_max_active = max_active;
33383337
3339− for_each_cwq_cpu(cpu, wq) {
3340− struct cpu_workqueue_struct *cwq = get_cwq(cpu, wq);
3341− struct worker_pool *pool = cwq->pool;
3338+ for_each_pwq_cpu(cpu, wq) {
3339+ struct pool_workqueue *pwq = get_pwq(cpu, wq);
3340+ struct worker_pool *pool = pwq->pool;
33423341
33433342 spin_lock_irq(&pool->lock);
33443343
33453344 if (!(wq->flags & WQ_FREEZABLE) ||
33463345 !(pool->flags & POOL_FREEZING))
3347− cwq_set_max_active(cwq, max_active);
3346+ pwq_set_max_active(pwq, max_active);
33483347
33493348 spin_unlock_irq(&pool->lock);
33503349 }
@@ -3367,9 +3366,9 @@ EXPORT_SYMBOL_GPL(workqueue_set_max_active); · 16 unmodified lines
33673366 */
33683367 bool workqueue_congested(unsigned int cpu, struct workqueue_struct *wq)
33693368 {
3370− struct cpu_workqueue_struct *cwq = get_cwq(cpu, wq);
3369+ struct pool_workqueue *pwq = get_pwq(cpu, wq);
33713370
3372− return !list_empty(&cwq->delayed_works);
3371+ return !list_empty(&pwq->delayed_works);
33733372 }
33743373 EXPORT_SYMBOL_GPL(workqueue_congested);
33753374
@@ -3408,7 +3407,7 @@ EXPORT_SYMBOL_GPL(work_busy); · 32 unmodified lines
34083407 * CPU hotplug.
34093408 *
34103409 * There are two challenges in supporting CPU hotplug. Firstly, there
3411− * are a lot of assumptions on strong associations among work, cwq and
3410+ * are a lot of assumptions on strong associations among work, pwq and
34123411 * pool which make migrating pending and scheduled works very
34133412 * difficult to implement without impacting hot paths. Secondly,
34143413 * worker pools serve mix of short, long and very long running works making
@@ -3612,11 +3611,11 @@ void freeze_workqueues_begin(void) · 197 unmodified lines
36123611 pool->flags |= POOL_FREEZING;
36133612
36143613 list_for_each_entry(wq, &workqueues, list) {
3615− struct cpu_workqueue_struct *cwq = get_cwq(cpu, wq);
3614+ struct pool_workqueue *pwq = get_pwq(cpu, wq);
36163615
3617− if (cwq && cwq->pool == pool &&
3616+ if (pwq && pwq->pool == pool &&
36183617 (wq->flags & WQ_FREEZABLE))
3619− cwq->max_active = 0;
3618+ pwq->max_active = 0;
36203619 }
36213620
36223621 spin_unlock_irq(&pool->lock);
@@ -3655,13 +3654,13 @@ bool freeze_workqueues_busy(void) · 32 unmodified lines
36553654 * to peek without lock.
36563655 */
36573656 list_for_each_entry(wq, &workqueues, list) {
3658− struct cpu_workqueue_struct *cwq = get_cwq(cpu, wq);
3657+ struct pool_workqueue *pwq = get_pwq(cpu, wq);
36593658
3660− if (!cwq || !(wq->flags & WQ_FREEZABLE))
3659+ if (!pwq || !(wq->flags & WQ_FREEZABLE))
36613660 continue;
36623661
3663− BUG_ON(cwq->nr_active < 0);
3664− if (cwq->nr_active) {
3662+ BUG_ON(pwq->nr_active < 0);
3663+ if (pwq->nr_active) {
36653664 busy = true;
36663665 goto out_unlock;
36673666 }
@@ -3701,14 +3700,14 @@ void thaw_workqueues(void) · 33 unmodified lines
37013700 pool->flags &= ~POOL_FREEZING;
37023701
37033702 list_for_each_entry(wq, &workqueues, list) {
3704− struct cpu_workqueue_struct *cwq = get_cwq(cpu, wq);
3703+ struct pool_workqueue *pwq = get_pwq(cpu, wq);
37053704
3706− if (!cwq || cwq->pool != pool ||
3705+ if (!pwq || pwq->pool != pool ||
37073706 !(wq->flags & WQ_FREEZABLE))
37083707 continue;
37093708
37103709 /* restore max_active and repopulate worklist */
3711− cwq_set_max_active(cwq, wq->saved_max_active);
3710+ pwq_set_max_active(pwq, wq->saved_max_active);
37123711 }
37133712
37143713 wake_up_worker(pool);

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