Skip to contentSkip to conversation

freezer: add try_to_freeze calls to all kernel threads

PATCH Stefan Richter 4 participants 8 messages May 9, 2007 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw
Quoted 11 lines · [email protected] wrote:

From: Rafael J. Wysocki <[email protected]>

Add try_to_freeze() calls to the remaining kernel threads that do not call try_to_freeze() already, although they set PF_NOFREEZE.

In the future we are going to replace PF_NOFREEZE with a set of flags that will be set to indicate in which situations the task should not be frozen (for example, there can be a task that should be frozen for the CPU hotplugging and should not be frozen for the system suspend). For this reason every kernel thread should be able to freeze itself (ie. call try_to_freeze()), so that it can be frozen whenever necessary.

A few questions:

Does try_to_freeze()'s kerneldoc document that try_to_freeze() is a no-op sometimes but should nevertheless be called for this and that reason? (I don't know the entire patch series.)

Why add no-op-try_to_freeze() everywhere now, instead of adding it later when it will actually be needed? (I.e. "in the future".)

Can we please have a future where no device driver has to care if and when and how to freeze its threads?

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

Hi!

Quoted 10 lines
Quoted 9 lines

Add try_to_freeze() calls to the remaining kernel threads that do not call try_to_freeze() already, although they set PF_NOFREEZE.

In the future we are going to replace PF_NOFREEZE with a set of flags that will be set to indicate in which situations the task should not be frozen (for example, there can be a task that should be frozen for the CPU hotplugging and should not be frozen for the system suspend). For this reason every kernel thread should be able to freeze itself (ie. call try_to_freeze()), so that it can be frozen whenever necessary.

Quoted 8 lines

A few questions:

Does try_to_freeze()'s kerneldoc document that try_to_freeze() is a no-op sometimes but should nevertheless be called for this and that reason? (I don't know the entire patch series.)

Why add no-op-try_to_freeze() everywhere now, instead of adding it later when it will actually be needed? (I.e. "in the future".)

It is needed later in the patch series... for kprobes, etc.

Quoted 2 lines

Can we please have a future where no device driver has to care if and when and how to freeze its threads?

No. Freezing is useful for kprobes/cpu hotplug as well as suspend.
Pavel

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#3 lore raw
Quoted 7 lines · Pavel Machek
Quoted 7 lines
Quoted 7 lines

Add try_to_freeze() calls to the remaining kernel threads that do not call try_to_freeze() already, although they set PF_NOFREEZE.

In the future we are going to replace PF_NOFREEZE with a set of flags that will be set to indicate in which situations the task should not be frozen (for example, there can be a task that should be frozen for the CPU hotplugging and should not be frozen for the system suspend).

[...]

Quoted 4 lines
Quoted 2 lines

Why add no-op-try_to_freeze() everywhere now, instead of adding it later when it will actually be needed? (I.e. "in the future".)

It is needed later in the patch series... for kprobes, etc.

So does freezer_exempt() still do what its name says, or does it freezer_exempt_but_not_always() now?

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

Hi Stefan,

Quoted 8 lines · Stefan Richter
Quoted 7 lines · Pavel Machek
Quoted 7 lines
Quoted 7 lines

Add try_to_freeze() calls to the remaining kernel threads that do not call try_to_freeze() already, although they set PF_NOFREEZE.

In the future we are going to replace PF_NOFREEZE with a set of flags that will be set to indicate in which situations the task should not be frozen (for example, there can be a task that should be frozen for the CPU hotplugging and should not be frozen for the system suspend).

Quoted 8 lines

[...]

Quoted 4 lines
Quoted 2 lines

Why add no-op-try_to_freeze() everywhere now, instead of adding it later when it will actually be needed? (I.e. "in the future".)

It is needed later in the patch series... for kprobes, etc.

So does freezer_exempt() still do what its name says, or does it freezer_exempt_but_not_always() now?

freezer_exempt() as of now does what its name says. I.e, exempt the thread from all kinds of freeze chills.

But with more subsystems using the process freezer, the exemption needs to be event specific. There may be threads which should not be frozen for say kprobes, should be frozen for cpu-hotplug. This selective freezing is not yet available. But it will be soon...

Quoted 4 lines
Signature · 3 lines
Stefan Richter
-=====-=-=== -=-= -=--=
http://arcgraph.de/sr/

Regards
gautham.

Signature · 5 lines
Gautham R Shenoy
Linux Technology Center
IBM India.
"Freedom comes with a price tag of responsibility, which is still a bargain,
because Freedom is priceless!"
#5 lore raw
Quoted 7 lines · Gautham R Shenoy

freezer_exempt() as of now does what its name says. I.e, exempt the thread from all kinds of freeze chills.

But with more subsystems using the process freezer, the exemption needs to be event specific. There may be threads which should not be frozen for say kprobes, should be frozen for cpu-hotplug. This selective freezing is not yet available. But it will be soon...

Thanks for the (necessary!) clarification.
Let me point out that the usual process would be to replace

	freezer_exempt(current);
	for (;;) {
		...;
by
	freezer_exempt_for_io(current);
	for (;;) {
		try_to_freeze();
		...;

when or after freezer_exempt_for_io was implemented.

But as it was submitted now, we are temporarily left with

	freezer_exempt(current);
	for (;;) {
		try_to_freeze();  /* useless irritating no-op */
		...;

without any benefit. (And this explanatory comment ^^^ wasn't even added; we only have the git log as explanation.)

As subsystem maintainer I have to trust now that "soon" actually means "soon" and not "RSN"; otherwise my responsibility would be to send a NAK.

Signature · 3 lines
Stefan Richter
-=====-=-=== -=-= -=--=
http://arcgraph.de/sr/
#6 lore raw
Quoted 21 lines · Stefan Richter
Quoted 7 lines · Gautham R Shenoy

freezer_exempt() as of now does what its name says. I.e, exempt the thread from all kinds of freeze chills.

But with more subsystems using the process freezer, the exemption needs to be event specific. There may be threads which should not be frozen for say kprobes, should be frozen for cpu-hotplug. This selective freezing is not yet available. But it will be soon...

Thanks for the (necessary!) clarification.
Let me point out that the usual process would be to replace

	freezer_exempt(current);
	for (;;) {
		...;
by
	freezer_exempt_for_io(current);
	for (;;) {
		try_to_freeze();
		...;
Quoted 2 lines

when or after freezer_exempt_for_io was implemented.

Well, a couple of RFC's have already been sent with this regard. Most of these recent freezer changes resulted due to the discussions that took place over these RFC's.

This was the first attempt
http://lkml.org/lkml/2007/2/14/106

and a more recent one
http://lkml.org/lkml/2007/4/2/33

Quoted 7 lines

But as it was submitted now, we are temporarily left with

	freezer_exempt(current);
	for (;;) {
		try_to_freeze();  /* useless irritating no-op */
		...;
Quoted 5 lines

without any benefit. (And this explanatory comment ^^^ wasn't even added; we only have the git log as explanation.)

As subsystem maintainer I have to trust now that "soon" actually means "soon" and not "RSN"; otherwise my responsibility would be to send a NAK.

Soon actually does mean soon :-)

http://lkml.org/lkml/2007/4/27/616 was sent out recently. I am working on the Rafael's suggestions.
The only thing holding these patches back is the fact that quite an amount of patches on the freezer/kthread front has gone in recently, which need more review and testing.

Will keep you posted on the freezer developments from now on.

Quoted 4 lines
Signature · 3 lines
Stefan Richter
-=====-=-=== -=-= -=--=
http://arcgraph.de/sr/

Thanks and Regards
gautham.

Signature · 5 lines
Gautham R Shenoy
Linux Technology Center
IBM India.
"Freedom comes with a price tag of responsibility, which is still a bargain,
because Freedom is priceless!"
#7 lore raw
Quoted 29 lines · Gautham R Shenoy
Quoted 21 lines · Stefan Richter
Quoted 7 lines · Gautham R Shenoy

freezer_exempt() as of now does what its name says. I.e, exempt the thread from all kinds of freeze chills.

But with more subsystems using the process freezer, the exemption needs to be event specific. There may be threads which should not be frozen for say kprobes, should be frozen for cpu-hotplug. This selective freezing is not yet available. But it will be soon...

Thanks for the (necessary!) clarification.
Let me point out that the usual process would be to replace

	freezer_exempt(current);
	for (;;) {
		...;
by
	freezer_exempt_for_io(current);
	for (;;) {
		try_to_freeze();
		...;
Quoted 2 lines

when or after freezer_exempt_for_io was implemented.

Well, a couple of RFC's have already been sent with this regard. Most of these recent freezer changes resulted due to the discussions that took place over these RFC's.

Quoted 15 lines

This was the first attempt
http://lkml.org/lkml/2007/2/14/106

and a more recent one
http://lkml.org/lkml/2007/4/2/33

Quoted 9 lines

But as it was submitted now, we are temporarily left with

	freezer_exempt(current);
	for (;;) {
		try_to_freeze();  /* useless irritating no-op */
		...;

without any benefit. (And this explanatory comment ^^^ wasn't even added; we only have the git log as explanation.)

I feel I ought to explain why it's ended up in this state.

This is not a new patch. It's been in -mm since 2.6.21-rc2-mm1 (at least) and we hoped to have the selective freezing of the system for different events done before the 2.6.22 merging window would open. It didn't happen, mainly for reasons that we couldn't control, and now we have some patches that depend on this one and are more urgent, since they're needed to fix some bugs.

Quoted 5 lines
Quoted 2 lines

As subsystem maintainer I have to trust now that "soon" actually means "soon" and not "RSN"; otherwise my responsibility would be to send a NAK.

Soon actually does mean soon :-)

Quoted 7 lines

http://lkml.org/lkml/2007/4/27/616 was sent out recently. I am working on the Rafael's suggestions.
The only thing holding these patches back is the fact that quite an amount of patches on the freezer/kthread front has gone in recently, which need more review and testing.

Will keep you posted on the freezer developments from now on.

Me too.

Greetings,
Rafael

#8 lore raw
Quoted 3 lines · Rafael J. Wysocki
Quoted 2 lines · Gautham R Shenoy
Quoted 1 line · Stefan Richter

Let me point out that the usual process would be

[...to do it in one go....]

Quoted 3 lines
Quoted 3 lines

Well, a couple of RFC's have already been sent with this regard. Most of these recent freezer changes resulted due to the discussions that took place over these RFC's.

[...]

Quoted 7 lines

I feel I ought to explain why it's ended up in this state.

This is not a new patch. It's been in -mm since 2.6.21-rc2-mm1 (at least) and we hoped to have the selective freezing of the system for different events done before the 2.6.22 merging window would open. It didn't happen, mainly for reasons that we couldn't control, and now we have some patches that depend on this one and are more urgent, since they're needed to fix some bugs.

OK, thanks once more for the explanations.

[...]

Quoted 3 lines
Quoted 1 line

Will keep you posted on the freezer developments from now on.

Me too.

Well, the mistake on my part was that I didn't pull -mm regularly, otherwise I would have automatically seen the change to the one kthread I am interested in.

Thanks,

Signature · 3 lines
Stefan Richter
-=====-=-=== -=-= -=--=
http://arcgraph.de/sr/