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.h49
1 files changed, 45 insertions, 4 deletions
diff --git a/include/linux/workqueue.h b/include/linux/workqueue.h
index 623488fdc1f5..594521ba0d43 100644
--- a/include/linux/workqueue.h
+++ b/include/linux/workqueue.h
@@ -295,7 +295,12 @@ static inline unsigned int work_static(struct work_struct *work) { return 0; }
295 * Documentation/workqueue.txt. 295 * Documentation/workqueue.txt.
296 */ 296 */
297enum { 297enum {
298 WQ_NON_REENTRANT = 1 << 0, /* guarantee non-reentrance */ 298 /*
299 * All wqs are now non-reentrant making the following flag
300 * meaningless. Will be removed.
301 */
302 WQ_NON_REENTRANT = 1 << 0, /* DEPRECATED */
303
299 WQ_UNBOUND = 1 << 1, /* not bound to any cpu */ 304 WQ_UNBOUND = 1 << 1, /* not bound to any cpu */
300 WQ_FREEZABLE = 1 << 2, /* freeze during suspend */ 305 WQ_FREEZABLE = 1 << 2, /* freeze during suspend */
301 WQ_MEM_RECLAIM = 1 << 3, /* may be used for memory reclaim */ 306 WQ_MEM_RECLAIM = 1 << 3, /* may be used for memory reclaim */
@@ -303,6 +308,33 @@ enum {
303 WQ_CPU_INTENSIVE = 1 << 5, /* cpu instensive workqueue */ 308 WQ_CPU_INTENSIVE = 1 << 5, /* cpu instensive workqueue */
304 WQ_SYSFS = 1 << 6, /* visible in sysfs, see wq_sysfs_register() */ 309 WQ_SYSFS = 1 << 6, /* visible in sysfs, see wq_sysfs_register() */
305 310
311 /*
312 * Per-cpu workqueues are generally preferred because they tend to
313 * show better performance thanks to cache locality. Per-cpu
314 * workqueues exclude the scheduler from choosing the CPU to
315 * execute the worker threads, which has an unfortunate side effect
316 * of increasing power consumption.
317 *
318 * The scheduler considers a CPU idle if it doesn't have any task
319 * to execute and tries to keep idle cores idle to conserve power;
320 * however, for example, a per-cpu work item scheduled from an
321 * interrupt handler on an idle CPU will force the scheduler to
322 * excute the work item on that CPU breaking the idleness, which in
323 * turn may lead to more scheduling choices which are sub-optimal
324 * in terms of power consumption.
325 *
326 * Workqueues marked with WQ_POWER_EFFICIENT are per-cpu by default
327 * but become unbound if workqueue.power_efficient kernel param is
328 * specified. Per-cpu workqueues which are identified to
329 * contribute significantly to power-consumption are identified and
330 * marked with this flag and enabling the power_efficient mode
331 * leads to noticeable power saving at the cost of small
332 * performance disadvantage.
333 *
334 * http://thread.gmane.org/gmane.linux.kernel/1480396
335 */
336 WQ_POWER_EFFICIENT = 1 << 7,
337
306 __WQ_DRAINING = 1 << 16, /* internal: workqueue is draining */ 338 __WQ_DRAINING = 1 << 16, /* internal: workqueue is draining */
307 __WQ_ORDERED = 1 << 17, /* internal: workqueue is ordered */ 339 __WQ_ORDERED = 1 << 17, /* internal: workqueue is ordered */
308 340
@@ -333,11 +365,19 @@ enum {
333 * 365 *
334 * system_freezable_wq is equivalent to system_wq except that it's 366 * system_freezable_wq is equivalent to system_wq except that it's
335 * freezable. 367 * freezable.
368 *
369 * *_power_efficient_wq are inclined towards saving power and converted
370 * into WQ_UNBOUND variants if 'wq_power_efficient' is enabled; otherwise,
371 * they are same as their non-power-efficient counterparts - e.g.
372 * system_power_efficient_wq is identical to system_wq if
373 * 'wq_power_efficient' is disabled. See WQ_POWER_EFFICIENT for more info.
336 */ 374 */
337extern struct workqueue_struct *system_wq; 375extern struct workqueue_struct *system_wq;
338extern struct workqueue_struct *system_long_wq; 376extern struct workqueue_struct *system_long_wq;
339extern struct workqueue_struct *system_unbound_wq; 377extern struct workqueue_struct *system_unbound_wq;
340extern struct workqueue_struct *system_freezable_wq; 378extern struct workqueue_struct *system_freezable_wq;
379extern struct workqueue_struct *system_power_efficient_wq;
380extern struct workqueue_struct *system_freezable_power_efficient_wq;
341 381
342static inline struct workqueue_struct * __deprecated __system_nrt_wq(void) 382static inline struct workqueue_struct * __deprecated __system_nrt_wq(void)
343{ 383{
@@ -410,11 +450,12 @@ __alloc_workqueue_key(const char *fmt, unsigned int flags, int max_active,
410 alloc_workqueue(fmt, WQ_UNBOUND | __WQ_ORDERED | (flags), 1, ##args) 450 alloc_workqueue(fmt, WQ_UNBOUND | __WQ_ORDERED | (flags), 1, ##args)
411 451
412#define create_workqueue(name) \ 452#define create_workqueue(name) \
413 alloc_workqueue((name), WQ_MEM_RECLAIM, 1) 453 alloc_workqueue("%s", WQ_MEM_RECLAIM, 1, (name))
414#define create_freezable_workqueue(name) \ 454#define create_freezable_workqueue(name) \
415 alloc_workqueue((name), WQ_FREEZABLE | WQ_UNBOUND | WQ_MEM_RECLAIM, 1) 455 alloc_workqueue("%s", WQ_FREEZABLE | WQ_UNBOUND | WQ_MEM_RECLAIM, \
456 1, (name))
416#define create_singlethread_workqueue(name) \ 457#define create_singlethread_workqueue(name) \
417 alloc_workqueue((name), WQ_UNBOUND | WQ_MEM_RECLAIM, 1) 458 alloc_workqueue("%s", WQ_UNBOUND | WQ_MEM_RECLAIM, 1, (name))
418 459
419extern void destroy_workqueue(struct workqueue_struct *wq); 460extern void destroy_workqueue(struct workqueue_struct *wq);
420 461