aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/workqueue.h
diff options
context:
space:
mode:
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