diff options
author | Viresh Kumar <viresh.kumar@linaro.org> | 2013-04-24 07:42:54 -0400 |
---|---|---|
committer | Tejun Heo <tj@kernel.org> | 2013-05-14 13:50:06 -0400 |
commit | 0668106ca3865ba945e155097fb042bf66d364d3 (patch) | |
tree | fbd6adfc2ae2f3c2b7fe7ad66d82cd7c64a001fb | |
parent | cee22a15052faa817e3ec8985a28154d3fabc7aa (diff) |
workqueue: Add system wide power_efficient workqueues
This patch adds system wide workqueues aligned towards power saving. This is
done by allocating them with WQ_UNBOUND flag if 'wq_power_efficient' is set to
'true'.
tj: updated comments a bit.
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Tejun Heo <tj@kernel.org>
-rw-r--r-- | include/linux/workqueue.h | 8 | ||||
-rw-r--r-- | kernel/workqueue.c | 13 |
2 files changed, 20 insertions, 1 deletions
diff --git a/include/linux/workqueue.h b/include/linux/workqueue.h index fc0136b604f2..a9f4119c7e2e 100644 --- a/include/linux/workqueue.h +++ b/include/linux/workqueue.h | |||
@@ -360,11 +360,19 @@ enum { | |||
360 | * | 360 | * |
361 | * 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 |
362 | * 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. | ||
363 | */ | 369 | */ |
364 | extern struct workqueue_struct *system_wq; | 370 | extern struct workqueue_struct *system_wq; |
365 | extern struct workqueue_struct *system_long_wq; | 371 | extern struct workqueue_struct *system_long_wq; |
366 | extern struct workqueue_struct *system_unbound_wq; | 372 | extern struct workqueue_struct *system_unbound_wq; |
367 | 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; | ||
368 | 376 | ||
369 | static inline struct workqueue_struct * __deprecated __system_nrt_wq(void) | 377 | static inline struct workqueue_struct * __deprecated __system_nrt_wq(void) |
370 | { | 378 | { |
diff --git a/kernel/workqueue.c b/kernel/workqueue.c index 8068d97ce141..16ca2d3dd29f 100644 --- a/kernel/workqueue.c +++ b/kernel/workqueue.c | |||
@@ -314,6 +314,10 @@ struct workqueue_struct *system_unbound_wq __read_mostly; | |||
314 | EXPORT_SYMBOL_GPL(system_unbound_wq); | 314 | EXPORT_SYMBOL_GPL(system_unbound_wq); |
315 | struct workqueue_struct *system_freezable_wq __read_mostly; | 315 | struct workqueue_struct *system_freezable_wq __read_mostly; |
316 | EXPORT_SYMBOL_GPL(system_freezable_wq); | 316 | EXPORT_SYMBOL_GPL(system_freezable_wq); |
317 | struct workqueue_struct *system_power_efficient_wq __read_mostly; | ||
318 | EXPORT_SYMBOL_GPL(system_power_efficient_wq); | ||
319 | struct workqueue_struct *system_freezable_power_efficient_wq __read_mostly; | ||
320 | EXPORT_SYMBOL_GPL(system_freezable_power_efficient_wq); | ||
317 | 321 | ||
318 | static int worker_thread(void *__worker); | 322 | static int worker_thread(void *__worker); |
319 | static void copy_workqueue_attrs(struct workqueue_attrs *to, | 323 | static void copy_workqueue_attrs(struct workqueue_attrs *to, |
@@ -4987,8 +4991,15 @@ static int __init init_workqueues(void) | |||
4987 | WQ_UNBOUND_MAX_ACTIVE); | 4991 | WQ_UNBOUND_MAX_ACTIVE); |
4988 | system_freezable_wq = alloc_workqueue("events_freezable", | 4992 | system_freezable_wq = alloc_workqueue("events_freezable", |
4989 | WQ_FREEZABLE, 0); | 4993 | WQ_FREEZABLE, 0); |
4994 | system_power_efficient_wq = alloc_workqueue("events_power_efficient", | ||
4995 | WQ_POWER_EFFICIENT, 0); | ||
4996 | system_freezable_power_efficient_wq = alloc_workqueue("events_freezable_power_efficient", | ||
4997 | WQ_FREEZABLE | WQ_POWER_EFFICIENT, | ||
4998 | 0); | ||
4990 | BUG_ON(!system_wq || !system_highpri_wq || !system_long_wq || | 4999 | BUG_ON(!system_wq || !system_highpri_wq || !system_long_wq || |
4991 | !system_unbound_wq || !system_freezable_wq); | 5000 | !system_unbound_wq || !system_freezable_wq || |
5001 | !system_power_efficient_wq || | ||
5002 | !system_freezable_power_efficient_wq); | ||
4992 | return 0; | 5003 | return 0; |
4993 | } | 5004 | } |
4994 | early_initcall(init_workqueues); | 5005 | early_initcall(init_workqueues); |