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