aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/workqueue.h
diff options
context:
space:
mode:
authorViresh Kumar <viresh.kumar@linaro.org>2013-04-08 07:15:40 -0400
committerTejun Heo <tj@kernel.org>2013-05-14 13:50:06 -0400
commitcee22a15052faa817e3ec8985a28154d3fabc7aa (patch)
tree506028de7bd3bf7de08a7933b5601355f27c5262 /include/linux/workqueue.h
parentf722406faae2d073cc1d01063d1123c35425939e (diff)
workqueues: Introduce new flag WQ_POWER_EFFICIENT for power oriented workqueues
Workqueues can be performance or power-oriented. Currently, most workqueues are bound to the CPU they were created on. This gives good performance (due to cache effects) at the cost of potentially waking up otherwise idle cores (Idle from scheduler's perspective. Which may or may not be physically idle) just to process some work. To save power, we can allow the work to be rescheduled on a core that is already awake. Workqueues created with the WQ_UNBOUND flag will allow some power savings. However, we don't change the default behaviour of the system. To enable power-saving behaviour, a new config option CONFIG_WQ_POWER_EFFICIENT needs to be turned on. This option can also be overridden by the workqueue.power_efficient boot parameter. tj: Updated config description and comments. Renamed CONFIG_WQ_POWER_EFFICIENT to CONFIG_WQ_POWER_EFFICIENT_DEFAULT. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Reviewed-by: Amit Kucheria <amit.kucheria@linaro.org> Signed-off-by: Tejun Heo <tj@kernel.org>
Diffstat (limited to 'include/linux/workqueue.h')
-rw-r--r--include/linux/workqueue.h27
1 files changed, 27 insertions, 0 deletions
diff --git a/include/linux/workqueue.h b/include/linux/workqueue.h
index 623488fdc1f5..fc0136b604f2 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