PM / Runtime: Use alloc_workqueue() for creating PM workqueue
Subsystems (2)
RFC PATCH 1/1 PM / Runtime: Use alloc_workqueue() for creating PM workqueue
From: Rafael J. Wysocki <[email protected]>
Subject: PM / Runtime: Use alloc_workqueue() for creating PM workqueue
Although we need the PM workqueue to be freezable, we don't need it to be singlethread. Also, the number of concurrent work items running on a single CPU need not be constrained. For these reasons use alloc_workqueue() directly, with suitable arguments, instead of create_freezeable_workqueue(), to create the runtime PM workqueue.
---
Tejun,
I'm not sure about that WQ_RESCUER thing. Can you please tell me what exactly it is for?
Thanks,
Rafael
--- kernel/power/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/power/main.c +1 -1
@@ -308,7 +308,7 @@ EXPORT_SYMBOL_GPL(pm_wq);static int __init pm_start_workqueue (void ) { - pm_wq =create_freezeable_workqueue ("pm" ); + pm_wq =alloc_workqueue ("pm" ,WQ_FREEZEABLE |WQ_RESCUER ,0 );return pm_wq ?0 : -ENOMEM ; }
Hello, Rafael.
Quoted 2 lines · Rafael J. Wysocki
I'm not sure about that
WQ_RESCUERthing. Can you please tell me what exactly it is for?
It's to guarantee forward progress for workqueues which process work items which may be used to reclaim memory. It reserves a rescue worker thread to be used under memory pressure. I finished workqueue documentation a few days ago and sent pull request to Linus.
So, for pm_wq, there's no reason to use WQ_RESUER. alloc_workqueue("pm", WQ_FREEZEABLE, 0) should do it.
Thanks for doing it.
Signature · 1 line
tejun
Hello, Rafael.
Quoted 2 lines · Rafael J. Wysocki
I'm not sure about that
WQ_RESCUERthing. Can you please tell me what exactly it is for?
It's to guarantee forward progress for workqueues which process work items which may be used to reclaim memory. It reserves a rescue worker thread to be used under memory pressure. I finished workqueue documentation a few days ago and sent pull request to Linus.
So, for pm_wq, there's no reason to use WQ_RESUER. alloc_workqueue("pm", WQ_FREEZEABLE, 0) should do it.
Thanks for doing it.
Signature · 1 line
tejun
Quoted 11 lines · Tejun Heo
Hello, Rafael.
Quoted 2 lines · Rafael J. Wysocki
I'm not sure about that
WQ_RESCUERthing. Can you please tell me what exactly it is for?It's to guarantee forward progress for workqueues which process work items which may be used to reclaim memory. It reserves a rescue worker thread to be used under memory pressure. I finished workqueue documentation a few days ago and sent pull request to Linus.
Quoted 4 lines
So, for
pm_wq, there's no reason to useWQ_RESUER.alloc_workqueue("pm", WQ_FREEZEABLE, 0)should do it.
Great, thanks!
Quoted 1 line
Thanks for doing it.
No big deal. Actually I should thank you for making it possible to use freezable workqueues that are not singlethread. :-)
Updated patch follows.
Thanks,
Rafael
---
From: Rafael J. Wysocki <[email protected]>
Subject: PM / Runtime: Use alloc_workqueue() for creating the PM workqueue
Although we need the PM workqueue to be freezable, we don't need it to be singlethread. Also, the number of concurrent work items running on a single CPU need not be constrained. For these reasons use alloc_workqueue() directly, with suitable arguments, instead of create_freezeable_workqueue(), to create the runtime PM workqueue.
--- kernel/power/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/power/main.c +1 -1
@@ -308,7 +308,7 @@ EXPORT_SYMBOL_GPL(pm_wq);static int __init pm_start_workqueue (void ) { - pm_wq =create_freezeable_workqueue ("pm" ); + pm_wq =alloc_workqueue ("pm" ,WQ_FREEZEABLE ,0 );return pm_wq ?0 : -ENOMEM ; }
Quoted 11 lines · Tejun Heo
Hello, Rafael.
Quoted 2 lines · Rafael J. Wysocki
I'm not sure about that
WQ_RESCUERthing. Can you please tell me what exactly it is for?It's to guarantee forward progress for workqueues which process work items which may be used to reclaim memory. It reserves a rescue worker thread to be used under memory pressure. I finished workqueue documentation a few days ago and sent pull request to Linus.
Quoted 4 lines
So, for
pm_wq, there's no reason to useWQ_RESUER.alloc_workqueue("pm", WQ_FREEZEABLE, 0)should do it.
Great, thanks!
Quoted 1 line
Thanks for doing it.
No big deal. Actually I should thank you for making it possible to use freezable workqueues that are not singlethread. :-)
Updated patch follows.
Thanks,
Rafael
---
From: Rafael J. Wysocki <[email protected]>
Subject: PM / Runtime: Use alloc_workqueue() for creating the PM workqueue
Although we need the PM workqueue to be freezable, we don't need it to be singlethread. Also, the number of concurrent work items running on a single CPU need not be constrained. For these reasons use alloc_workqueue() directly, with suitable arguments, instead of create_freezeable_workqueue(), to create the runtime PM workqueue.
--- kernel/power/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/power/main.c +1 -1
@@ -308,7 +308,7 @@ EXPORT_SYMBOL_GPL(pm_wq);static int __init pm_start_workqueue (void ) { - pm_wq =create_freezeable_workqueue ("pm" ); + pm_wq =alloc_workqueue ("pm" ,WQ_FREEZEABLE ,0 );return pm_wq ?0 : -ENOMEM ; }
Tejun Heo
Acked-byQuoted 10 lines · Rafael J. Wysocki
From: Rafael J. Wysocki <[email protected]>
Subject: PM / Runtime: Usealloc_workqueue()for creating the PM workqueueAlthough we need the PM workqueue to be freezable, we don't need it to be singlethread. Also, the number of concurrent work items running on a single CPU need not be constrained. For these reasons use
alloc_workqueue()directly, with suitable arguments, instead ofcreate_freezeable_workqueue(), to create the runtime PM workqueue.Signed-off-by Rafael J. Wysocki <[email protected]>
Thanks.
Signature · 1 line
tejun