linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC][PATCH] PM / Runtime: Use alloc_workqueue() for creating PM workqueue
@ 2010-09-15 19:56 Rafael J. Wysocki
  2010-09-16  8:11 ` Tejun Heo
  0 siblings, 1 reply; 4+ messages in thread
From: Rafael J. Wysocki @ 2010-09-15 19:56 UTC (permalink / raw)
  To: Tejun Heo; +Cc: Linux-pm mailing list, LKML, Alan Stern

From: Rafael J. Wysocki <rjw@sisk.pl>
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.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
---

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(-)

Index: linux-2.6/kernel/power/main.c
===================================================================
--- linux-2.6.orig/kernel/power/main.c
+++ linux-2.6/kernel/power/main.c
@@ -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;
 }

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [RFC][PATCH] PM / Runtime: Use alloc_workqueue() for creating PM workqueue
  2010-09-15 19:56 [RFC][PATCH] PM / Runtime: Use alloc_workqueue() for creating PM workqueue Rafael J. Wysocki
@ 2010-09-16  8:11 ` Tejun Heo
  2010-09-16 18:24   ` Rafael J. Wysocki
  0 siblings, 1 reply; 4+ messages in thread
From: Tejun Heo @ 2010-09-16  8:11 UTC (permalink / raw)
  To: Rafael J. Wysocki; +Cc: Linux-pm mailing list, LKML, Alan Stern

Hello, Rafael.

On 09/15/2010 09:56 PM, Rafael J. Wysocki wrote:
> I'm not sure about that WQ_RESCUER thing.  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.

  http://git.kernel.org/?p=linux/kernel/git/tj/wq.git;a=blob;f=Documentation/workqueue.txt;h=e4498a2872c37a0b3b156ddc7ad7135d030d224d;hb=c54fce6eff197d9c57c97afbf6c9722ce434fc8f

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.

-- 
tejun

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [RFC][PATCH] PM / Runtime: Use alloc_workqueue() for creating PM workqueue
  2010-09-16  8:11 ` Tejun Heo
@ 2010-09-16 18:24   ` Rafael J. Wysocki
  2010-09-17  9:57     ` Tejun Heo
  0 siblings, 1 reply; 4+ messages in thread
From: Rafael J. Wysocki @ 2010-09-16 18:24 UTC (permalink / raw)
  To: Tejun Heo; +Cc: Linux-pm mailing list, LKML, Alan Stern, Arjan van de Ven

On Thursday, September 16, 2010, Tejun Heo wrote:
> Hello, Rafael.
> 
> On 09/15/2010 09:56 PM, Rafael J. Wysocki wrote:
> > I'm not sure about that WQ_RESCUER thing.  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.
> 
>   http://git.kernel.org/?p=linux/kernel/git/tj/wq.git;a=blob;f=Documentation/workqueue.txt;h=e4498a2872c37a0b3b156ddc7ad7135d030d224d;hb=c54fce6eff197d9c57c97afbf6c9722ce434fc8f
> 
> So, for pm_wq, there's no reason to use WQ_RESUER.
> alloc_workqueue("pm", WQ_FREEZEABLE, 0) should do it.

Great, thanks!

> 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 <rjw@sisk.pl>
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.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
---
 kernel/power/main.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Index: linux-2.6/kernel/power/main.c
===================================================================
--- linux-2.6.orig/kernel/power/main.c
+++ linux-2.6/kernel/power/main.c
@@ -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;
 }

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [RFC][PATCH] PM / Runtime: Use alloc_workqueue() for creating PM workqueue
  2010-09-16 18:24   ` Rafael J. Wysocki
@ 2010-09-17  9:57     ` Tejun Heo
  0 siblings, 0 replies; 4+ messages in thread
From: Tejun Heo @ 2010-09-17  9:57 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: Linux-pm mailing list, LKML, Alan Stern, Arjan van de Ven

On 09/16/2010 08:24 PM, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rjw@sisk.pl>
> 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.
> 
> Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>

Acked-by: Tejun Heo <tj@kernel.org>

Thanks.

-- 
tejun

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-09-17  9:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-15 19:56 [RFC][PATCH] PM / Runtime: Use alloc_workqueue() for creating PM workqueue Rafael J. Wysocki
2010-09-16  8:11 ` Tejun Heo
2010-09-16 18:24   ` Rafael J. Wysocki
2010-09-17  9:57     ` Tejun Heo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).