aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/workqueue.h
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2010-06-29 04:07:14 -0400
committerTejun Heo <tj@kernel.org>2010-06-29 04:07:14 -0400
commitd320c03830b17af64e4547075003b1eeb274bc6c (patch)
tree9917a69dc2efa6f37c54097c4651408faf4b343b /include/linux/workqueue.h
parentb71ab8c2025caef8db719aa41af0ed735dc543cd (diff)
workqueue: s/__create_workqueue()/alloc_workqueue()/, and add system workqueues
This patch makes changes to make new workqueue features available to its users. * Now that workqueue is more featureful, there should be a public workqueue creation function which takes paramters to control them. Rename __create_workqueue() to alloc_workqueue() and make 0 max_active mean WQ_DFL_ACTIVE. In the long run, all create_workqueue_*() will be converted over to alloc_workqueue(). * To further unify access interface, rename keventd_wq to system_wq and export it. * Add system_long_wq and system_nrt_wq. The former is to host long running works separately (so that flush_scheduled_work() dosen't take so long) and the latter guarantees any queued work item is never executed in parallel by multiple CPUs. These will be used by future patches to update workqueue users. Signed-off-by: Tejun Heo <tj@kernel.org>
Diffstat (limited to 'include/linux/workqueue.h')
-rw-r--r--include/linux/workqueue.h40
1 files changed, 29 insertions, 11 deletions
diff --git a/include/linux/workqueue.h b/include/linux/workqueue.h
index 33e24e734d50..48b7422f25ae 100644
--- a/include/linux/workqueue.h
+++ b/include/linux/workqueue.h
@@ -232,12 +232,31 @@ enum {
232 WQ_DFL_ACTIVE = WQ_MAX_ACTIVE / 2, 232 WQ_DFL_ACTIVE = WQ_MAX_ACTIVE / 2,
233}; 233};
234 234
235/*
236 * System-wide workqueues which are always present.
237 *
238 * system_wq is the one used by schedule[_delayed]_work[_on]().
239 * Multi-CPU multi-threaded. There are users which expect relatively
240 * short queue flush time. Don't queue works which can run for too
241 * long.
242 *
243 * system_long_wq is similar to system_wq but may host long running
244 * works. Queue flushing might take relatively long.
245 *
246 * system_nrt_wq is non-reentrant and guarantees that any given work
247 * item is never executed in parallel by multiple CPUs. Queue
248 * flushing might take relatively long.
249 */
250extern struct workqueue_struct *system_wq;
251extern struct workqueue_struct *system_long_wq;
252extern struct workqueue_struct *system_nrt_wq;
253
235extern struct workqueue_struct * 254extern struct workqueue_struct *
236__create_workqueue_key(const char *name, unsigned int flags, int max_active, 255__alloc_workqueue_key(const char *name, unsigned int flags, int max_active,
237 struct lock_class_key *key, const char *lock_name); 256 struct lock_class_key *key, const char *lock_name);
238 257
239#ifdef CONFIG_LOCKDEP 258#ifdef CONFIG_LOCKDEP
240#define __create_workqueue(name, flags, max_active) \ 259#define alloc_workqueue(name, flags, max_active) \
241({ \ 260({ \
242 static struct lock_class_key __key; \ 261 static struct lock_class_key __key; \
243 const char *__lock_name; \ 262 const char *__lock_name; \
@@ -247,21 +266,20 @@ __create_workqueue_key(const char *name, unsigned int flags, int max_active,
247 else \ 266 else \
248 __lock_name = #name; \ 267 __lock_name = #name; \
249 \ 268 \
250 __create_workqueue_key((name), (flags), (max_active), \ 269 __alloc_workqueue_key((name), (flags), (max_active), \
251 &__key, __lock_name); \ 270 &__key, __lock_name); \
252}) 271})
253#else 272#else
254#define __create_workqueue(name, flags, max_active) \ 273#define alloc_workqueue(name, flags, max_active) \
255 __create_workqueue_key((name), (flags), (max_active), NULL, NULL) 274 __alloc_workqueue_key((name), (flags), (max_active), NULL, NULL)
256#endif 275#endif
257 276
258#define create_workqueue(name) \ 277#define create_workqueue(name) \
259 __create_workqueue((name), WQ_RESCUER, 1) 278 alloc_workqueue((name), WQ_RESCUER, 1)
260#define create_freezeable_workqueue(name) \ 279#define create_freezeable_workqueue(name) \
261 __create_workqueue((name), \ 280 alloc_workqueue((name), WQ_FREEZEABLE | WQ_SINGLE_CPU | WQ_RESCUER, 1)
262 WQ_FREEZEABLE | WQ_SINGLE_CPU | WQ_RESCUER, 1)
263#define create_singlethread_workqueue(name) \ 281#define create_singlethread_workqueue(name) \
264 __create_workqueue((name), WQ_SINGLE_CPU | WQ_RESCUER, 1) 282 alloc_workqueue((name), WQ_SINGLE_CPU | WQ_RESCUER, 1)
265 283
266extern void destroy_workqueue(struct workqueue_struct *wq); 284extern void destroy_workqueue(struct workqueue_struct *wq);
267 285