aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2010-08-01 05:50:12 -0400
committerTejun Heo <tj@kernel.org>2010-08-01 05:50:12 -0400
commit098849516dd522a343e659740c8f1394a5b7fa69 (patch)
tree46e902aabf3734c68173e959735ee75760b9f911
parent40f2b6ffe525e975203c1621d4d4abaa7689b674 (diff)
workqueue: explain for_each_*cwq_cpu() iterators
for_each_*cwq_cpu() are similar to regular CPU iterators except that it also considers the pseudo CPU number used for unbound workqueues. Explain them. Signed-off-by: Tejun Heo <tj@kernel.org> Cc: Andrew Morton <akpm@linux-foundation.org>
-rw-r--r--kernel/workqueue.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index e5cb7faac58..1105c474073 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -271,6 +271,19 @@ static inline int __next_wq_cpu(int cpu, const struct cpumask *mask,
271 return __next_gcwq_cpu(cpu, mask, !(wq->flags & WQ_UNBOUND) ? 1 : 2); 271 return __next_gcwq_cpu(cpu, mask, !(wq->flags & WQ_UNBOUND) ? 1 : 2);
272} 272}
273 273
274/*
275 * CPU iterators
276 *
277 * An extra gcwq is defined for an invalid cpu number
278 * (WORK_CPU_UNBOUND) to host workqueues which are not bound to any
279 * specific CPU. The following iterators are similar to
280 * for_each_*_cpu() iterators but also considers the unbound gcwq.
281 *
282 * for_each_gcwq_cpu() : possible CPUs + WORK_CPU_UNBOUND
283 * for_each_online_gcwq_cpu() : online CPUs + WORK_CPU_UNBOUND
284 * for_each_cwq_cpu() : possible CPUs for bound workqueues,
285 * WORK_CPU_UNBOUND for unbound workqueues
286 */
274#define for_each_gcwq_cpu(cpu) \ 287#define for_each_gcwq_cpu(cpu) \
275 for ((cpu) = __next_gcwq_cpu(-1, cpu_possible_mask, 3); \ 288 for ((cpu) = __next_gcwq_cpu(-1, cpu_possible_mask, 3); \
276 (cpu) < WORK_CPU_NONE; \ 289 (cpu) < WORK_CPU_NONE; \