Skip to contentSkip to conversation

When to use a freezeable workqueue?

DISCUSSION Stefan Richter 3 participants 5 messages Aug 12, 2007 – Aug 13, 2007

lore
Share & tools
lore
#0 lore raw

In which situations is create_freezeable_workqueue() to be preferred over create_singlethread_workqueue()?

Is a freezable worqueue preferable whenever the worker thread /can/ be frozen, or is it only to be used if the thread /must/ be frozen during suspend?

Thanks,

Signature · 3 lines
Stefan Richter
-=====-=-=== =--- -==--
http://arcgraph.de/sr/
#1 lore raw
Quoted 6 lines · Stefan Richter

In which situations is create_freezeable_workqueue() to be preferred over create_singlethread_workqueue()?

Is a freezable worqueue preferable whenever the worker thread /can/ be frozen, or is it only to be used if the thread /must/ be frozen during suspend?

The latter, IMO.

Generally, if you want it to be frozen.

Greetings,
Rafael

#2 lore raw
Quoted 11 lines · Rafael J. Wysocki
Quoted 6 lines · Stefan Richter

In which situations is create_freezeable_workqueue() to be preferred over create_singlethread_workqueue()?

Is a freezable worqueue preferable whenever the worker thread /can/ be frozen, or is it only to be used if the thread /must/ be frozen during suspend?

The latter, IMO.

Generally, if you want it to be frozen.

A good example of a reason for making a workqueue freezable is that the workqueue contains entries which would cause a suspended device to be resumed. Obviously you don't want such things to happen while the system is going to sleep. A little less obviously, there might also be problems if such a routine ran while the system was waking up.

Another reason might be that the workqueue contains entries which would try to register or unregister a device. Such actions aren't a good idea at times when the PM core is iterating through a list of all devices in order to suspend or resume them. And in the future such actions may block, effectively freezing the workqueue anyway -- which could be troublesome if you don't want the workqueue to be frozen!

Alan Stern

#3 lore raw
In reply to Rafael J. Wysocki
Quoted 11 lines · Rafael J. Wysocki
Quoted 6 lines · Stefan Richter

In which situations is create_freezeable_workqueue() to be preferred over create_singlethread_workqueue()?

Is a freezable worqueue preferable whenever the worker thread /can/ be frozen, or is it only to be used if the thread /must/ be frozen during suspend?

The latter, IMO.

Generally, if you want it to be frozen.

A good example of a reason for making a workqueue freezable is that the workqueue contains entries which would cause a suspended device to be resumed. Obviously you don't want such things to happen while the system is going to sleep. A little less obviously, there might also be problems if such a routine ran while the system was waking up.

Another reason might be that the workqueue contains entries which would try to register or unregister a device. Such actions aren't a good idea at times when the PM core is iterating through a list of all devices in order to suspend or resume them. And in the future such actions may block, effectively freezing the workqueue anyway -- which could be troublesome if you don't want the workqueue to be frozen!

Alan Stern

#4 lore raw
In reply to Stefan Richter
Quoted 6 lines · Stefan Richter

In which situations is create_freezeable_workqueue() to be preferred over create_singlethread_workqueue()?

Is a freezable worqueue preferable whenever the worker thread /can/ be frozen, or is it only to be used if the thread /must/ be frozen during suspend?

The latter, IMO.

Generally, if you want it to be frozen.

Greetings,
Rafael