Skip to contentSkip to conversation

swsusp: separate swap-writing/reading code

PATCH Nigel Cunningham 7 participants 16 messages Mar 23, 2006 – Mar 28, 2006 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

Hi.

Quoted 7 lines · Linux Kernel Mailing List

commit 61159a314bca6408320c3173c1282c64f5cdaa76
tree 8e1b7627443da0fd52b2fac66366dde9f7871f1e
parent f577eb30afdc68233f25d4d82b04102129262365
author Rafael J. Wysocki <[email protected]> Thu, 23 Mar 2006 19:00:00 -0800 committer Linus Torvalds <[email protected]> Thu, 23 Mar 2006 23:38:07 -0800

Quoted 8 lines

[PATCH] swsusp: separate swap-writing/reading code

Move the swap-writing/reading code of swsusp to a separate file.

I guess I missed this one somehow. Using a bitmap for allocated swap is really inefficient because the values are usually not fragmented much. Extents would have been a far better choice.

Regards,

Nigel

#2 lore raw

Hi,

Quoted 12 lines · Nigel Cunningham
Quoted 11 lines · Linux Kernel Mailing List

commit 61159a314bca6408320c3173c1282c64f5cdaa76
tree 8e1b7627443da0fd52b2fac66366dde9f7871f1e
parent f577eb30afdc68233f25d4d82b04102129262365
author Rafael J. Wysocki <[email protected]> Thu, 23 Mar 2006 19:00:00 -0800 committer Linus Torvalds <[email protected]> Thu, 23 Mar 2006 23:38:07 -0800

[PATCH] swsusp: separate swap-writing/reading code

Move the swap-writing/reading code of swsusp to a separate file.

Quoted 8 lines
Quoted 4 lines

I guess I missed this one somehow. Using a bitmap for allocated swap is really inefficient because the values are usually not fragmented much. Extents would have been a far better choice.

I agree it probably may be improved. Still it seems to be good enough. Further, it's more efficient than the previous solution, so I consider it as an improvement. Also this code has been tested for quite some time in -mm and appears to behave properly, at least we haven't got any bug reports related to it so far.

Currently I'm not working on any better solution. If you can provide any patches to implement one, please submit them, but I think they'll have to be tested for as long as this code, in -mm.

Greetings,
Rafael

#3 lore raw
Quoted 5 lines · Rafael J. Wysocki

I agree it probably may be improved. Still it seems to be good enough. Further, it's more efficient than the previous solution, so I consider it as an improvement. Also this code has been tested for quite some time in -mm and appears to behave properly, at least we haven't got any bug reports related to it so far.

I find the in-kernel swsusp to be quite slow, and it seems to use an awful lot of memory for book-keeping. So count that as encouragement to improve the performance when you can.

Quoted 3 lines

Currently I'm not working on any better solution. If you can provide any patches to implement one, please submit them, but I think they'll have to be tested for as long as this code, in -mm.

It would be *really nice* if you guys could stop being so underhandedly nasty in every single reply to anything from Nigel.

He really is trying to help, you know.

Cheers

#4 lore raw

Hi,

Quoted 10 lines · Mark Lord
Quoted 5 lines · Rafael J. Wysocki

I agree it probably may be improved. Still it seems to be good enough. Further, it's more efficient than the previous solution, so I consider it as an improvement. Also this code has been tested for quite some time in -mm and appears to behave properly, at least we haven't got any bug reports related to it so far.

I find the in-kernel swsusp to be quite slow, and it seems to use an awful lot of memory for book-keeping. So count that as encouragement to improve the performance when you can.

This particular patch actually decreases the amount of memory used by swsusp.

Moreover I have _nothing_ against improvements, but it requires some time to improve things.

Quoted 6 lines
Quoted 3 lines

Currently I'm not working on any better solution. If you can provide any patches to implement one, please submit them, but I think they'll have to be tested for as long as this code, in -mm.

It would be *really nice* if you guys could stop being so underhandedly nasty in every single reply to anything from Nigel.

Well, you know, it's generally easy to say that something's done in a wrong way, but this alone doesn't help _anyone_.

Suggestions are nice, but _someone_ has to implement them and I think Nigel is more than capable of doing it in this particular case. Also the code in question is quite sensitive and such that it should be tested for a longer time IMO.

That's what I was trying to say and it was not my intention to be nasty at all.

Greetings,
Rafael

#5 lore raw
In reply to Mark Lord
Quoted 10 lines · Mark Lord
Quoted 8 lines · Rafael J. Wysocki

I agree it probably may be improved. Still it seems to be good enough. Further,
it's more efficient than the previous solution, so I consider it as an improvement.
Also this code has been tested for quite some time in -mm and appears to behave properly, at least we haven't got any bug reports related to it so far.

Quoted 3 lines

I find the in-kernel swsusp to be quite slow, and it seems to use an awful lot of memory for book-keeping. So count that as encouragement to improve the performance when you can.

Extents will provide 0.01% speedup at most, and with increase of code complexity. Not a nice tradeoff if you ask me.

If you want faster suspend, that should be easy. You'll need *current* 2.6.16-git , and userland tools from suspend.sf.net . There's HOWTO that explains how to set it up. We can even do LZF these days...

Quoted 9 lines
Quoted 4 lines

Currently I'm not working on any better solution. If you can provide any patches to implement one, please submit them, but I think they'll have to be
tested for as long as this code, in -mm.

It would be *really nice* if you guys could stop being so underhandedly nasty in every single reply to anything from Nigel.

He really is trying to help, you know.

Actually Rafael was *very* nice at him, I'd say. Pointing for tiny inefficiencies, without patch attached is not really helpful.

I have repeatedly pointed him on ways how he can *really* help. There are ways to do suspend2 in userspace these days, but Nigel refuses to use them.
Pavel

Signature · 1 line
Picture of sleeping (Linux) penguin wanted...
#6 lore raw

Hi Pavel.

Quoted 10 lines · Pavel Machek
Quoted 9 lines · Mark Lord
Quoted 7 lines · Rafael J. Wysocki

I agree it probably may be improved. Still it seems to be good enough. Further,
it's more efficient than the previous solution, so I consider it as an improvement.
Also this code has been tested for quite some time in -mm and appears to behave properly, at least we haven't got any bug reports related to it so far.

Quoted 6 lines
Quoted 3 lines

I find the in-kernel swsusp to be quite slow, and it seems to use an awful lot of memory for book-keeping. So count that as encouragement to improve the performance when you can.

Extents will provide 0.01% speedup at most, and with increase of code complexity. Not a nice tradeoff if you ask me.

My point wasn't speed, but efficient use of memory. A bitmap is certainly better than storing n*sizeof(swap_entry_t) byes. Extents would be better again, but perhaps not as big after the bitmap switch.

Quoted 9 lines

If you want faster suspend, that should be easy. You'll need *current* 2.6.16-git , and userland tools from suspend.sf.net . There's HOWTO that explains how to set it up. We can even do LZF these days...

Quoted 5 lines
Quoted 4 lines

Currently I'm not working on any better solution. If you can provide any patches to implement one, please submit them, but I think they'll have to be
tested for as long as this code, in -mm.

Quoted 7 lines
Quoted 4 lines

It would be *really nice* if you guys could stop being so underhandedly nasty in every single reply to anything from Nigel.

He really is trying to help, you know.

Actually Rafael was *very* nice at him, I'd say. Pointing for tiny inefficiencies, without patch attached is not really helpful.

Yes, I didn't think Rafael was harsh in that email, but that's just my opinion. Regarding "without patch attached", could you please remember that comment next time you comment on my patches?

Quoted 3 lines

I have repeatedly pointed him on ways how he can *really* help. There are ways to do suspend2 in userspace these days, but Nigel refuses to use them.

You know that I disagree that doing suspend in userspace is the right approach, and you know that current uswsusp can't do everything Suspend2 does without further substantial modification. Please stop painting me as the bad guy because I won't roll over and play dead for you. Please also stop encouraging people to use uswsusp when you have also warned that it might eat their partitions.

Regards,

Nigel

#7 lore raw

regular swsusp flamewar [was Re: [PATCH] swsusp: separate swap-writing/reading code]

Hi!

Quoted 9 lines
Quoted 9 lines

If you want faster suspend, that should be easy. You'll need *current* 2.6.16-git , and userland tools from suspend.sf.net . There's HOWTO that explains how to set it up. We can even do LZF these days...

Quoted 5 lines
Quoted 4 lines

Currently I'm not working on any better solution. If you can provide any patches to implement one, please submit them, but I think they'll have to be
tested for as long as this code, in -mm.

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

It would be *really nice* if you guys could stop being so underhandedly nasty in every single reply to anything from Nigel.

He really is trying to help, you know.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Quoted 2 lines
Quoted 2 lines

Actually Rafael was *very* nice at him, I'd say. Pointing for tiny inefficiencies, without patch attached is not really helpful.

...

Quoted 6 lines
Quoted 3 lines

I have repeatedly pointed him on ways how he can *really* help. There are ways to do suspend2 in userspace these days, but Nigel refuses to use them.

You know that I disagree that doing suspend in userspace is the right

You know "disagreeing" with subsystem maintainer (and everyone else for that matter) is not exactly helpful in getting patches merged. You are free to believe whatever you want, but if you disagree on something as fundamental as "do not put unneccessary code to kernel" with me, it should be no surprise that I "disagree" with your patches (*).

Quoted 4 lines

approach, and you know that current uswsusp can't do everything Suspend2 does without further substantial modification. Please stop painting me as the bad guy because I won't roll over and play dead for you. Please also stop

I'm not trying to paint you as a bad guy. But Mark said you are trying to help, and in that context I'd read it as "trying to help mainline development". And you are not doing that, you are developing your own suspend2 branch, that has nothing to do with mainline. I think we can agree on that one...

Quoted 2 lines

encouraging people to use uswsusp when you have also warned that it might eat their partitions.

uswsusp is now reasonably stable. Of course, it was dangerous some time ago. Every software is dangerous when it is young.
Pavel

(*) Actually I can't "disagree" with your patches because you did not submit any, in recent history.

Signature · 1 line
Picture of sleeping (Linux) penguin wanted...
#8 lore raw

Re: regular swsusp flamewar [was Re: [PATCH] swsusp: separate swap-writing/reading code]

Hello.

I'm not playing that game again.

Instead I'm letting you know that I'm building a git tree at the moment, and hope to start posting patches from it shortly and seeking to merge Suspend2. A few weeks ago I lacked the motivation to do it, but that has since changed.

If you want to provide useful, technical comments on how I can do things better, I'll be happy to accept and apply them. If on the other hand you attempt to start another flamewar, I'll just seek to exercise my self control and let those comments fall to the floor.

Regards,

Nigel

#9 lore raw

Re: regular swsusp flamewar

Quoted 4 lines · Nigel Cunningham

Hello.

I'm not playing that game again.

Quoted 8 lines

Instead I'm letting you know that I'm building a git tree at the moment, and hope to start posting patches from it shortly and seeking to merge Suspend2. A few weeks ago I lacked the motivation to do it, but that has since changed.

If you want to provide useful, technical comments on how I can do things better, I'll be happy to accept and apply them. If on the other hand you attempt to start another flamewar, I'll just seek to exercise my self control and let those comments fall to the floor.

_Please_ continue, Nigel! We (at least I) need a working suspend, and it would be a great benefit to have it in the vanilla kernel.

Signature · 1 line
Hilsen Harald.
#10 lore raw

Re: regular swsusp flamewar [was Re: [PATCH] swsusp: separate swap-writing/reading code]

In reply to Nigel Cunningham
Quoted 7 lines · Nigel Cunningham

Hello.

I'm not playing that game again.

Instead I'm letting you know that I'm building a git tree at the moment, and hope to start posting patches from it shortly and seeking to merge Suspend2. A few weeks ago I lacked the motivation to do it, but that has since changed.

Just out of interest... what made you motivated? (Not that it is important and feel free to tell me I don't need to know, or reply privately...)

Pavel

Signature · 1 line
Picture of sleeping (Linux) penguin wanted...
#11 lore raw

Re: regular swsusp flamewar [was Re: [PATCH] swsusp: separate swap-writing/reading code]

Hi.

Quoted 5 lines · Pavel Machek
Quoted 4 lines · Nigel Cunningham

Hello.

I'm not playing that game again.

Quoted 8 lines
Quoted 4 lines

Instead I'm letting you know that I'm building a git tree at the moment, and hope to start posting patches from it shortly and seeking to merge Suspend2. A few weeks ago I lacked the motivation to do it, but that has since changed.

Just out of interest... what made you motivated? (Not that it is important and feel free to tell me I don't need to know, or reply privately...)

You did.

Regards,

Nigel

#12 lore raw

Re: regular swsusp flamewar [was Re: [PATCH] swsusp: separate swap-writing/reading code]

In reply to Nigel Cunningham

Hi!

Quoted 1 line

I'm not playing that game again.

Good.

Quoted 3 lines

Instead I'm letting you know that I'm building a git tree at the moment, and hope to start posting patches from it shortly and seeking to merge Suspend2. A few weeks ago I lacked the motivation to do it, but that has since changed.

Please cc me when the patches are ready, and good luck with git.
Pavel

Signature · 1 line
Picture of sleeping (Linux) penguin wanted...
#13 lore raw

Re: regular swsusp flamewar

In reply to Pavel Machek
Quoted 15 lines · Pavel Machek
Quoted 2 lines

You know that I disagree that doing suspend in userspace is the right

You know "disagreeing" with subsystem maintainer (and everyone else for that matter) is not exactly helpful in getting patches merged. You are free to believe whatever you want, but if you disagree on something as fundamental as "do not put unneccessary code to kernel" with me, it should be no surprise that I "disagree" with your patches (*).

Quoted 4 lines

approach, and you know that current uswsusp can't do everything Suspend2 does without further substantial modification. Please stop painting me as the bad guy because I won't roll over and play dead for you. Please also stop

Quoted 5 lines

I'm not trying to paint you as a bad guy. But Mark said you are trying to help, and in that context I'd read it as "trying to help mainline development". And you are not doing that, you are developing your own suspend2 branch, that has nothing to do with mainline. I think we can agree on that one...

The main point for me is that suspend2 works, while mainline supspend does not ("works": it takes less time to suspend/resume than to shutdown/reboot).

I haven't tried uswsusp yet. Why try another out-of-kernel suspend when suspend2 works perfectly?

Signature · 1 line
Hilsen Harald.
#14 lore raw

Re: regular swsusp flamewar

Quoted 6 lines · Harald Arnesen

The main point for me is that suspend2 works, while mainline supspend does not ("works": it takes less time to suspend/resume than to shutdown/reboot).

I haven't tried uswsusp yet. Why try another out-of-kernel suspend when suspend2 works perfectly?

uswsusp is not out-of-tree any more (but you'll need recent tree from git). You should try in-kernel options before patching your kernel, I'd say. Userland tools are at suspend.sf.net.

Pavel

Signature · 1 line
Picture of sleeping (Linux) penguin wanted...
#15 lore raw
In reply to Rafael J. Wysocki
Quoted 9 lines · Rafael J. Wysocki
Quoted 4 lines

I guess I missed this one somehow. Using a bitmap for allocated swap is really inefficient because the values are usually not fragmented much. Extents would have been a far better choice.

I agree it probably may be improved. Still it seems to be good enough. Further, it's more efficient than the previous solution, so I consider it as an improvement. Also this code has been tested for quite some time in -mm and appears to behave properly, at least we haven't got any bug reports related to it so far.

I think that temporarily allocating 1/32768th of total memory here is reasonable, especially as it's not all allocated in a contiguous hunk.

Quoted 3 lines

Currently I'm not working on any better solution. If you can provide any patches to implement one, please submit them, but I think they'll have to be tested for as long as this code, in -mm.

I was a little saddened by the open-coded approach. I'd expect that both radix-trees and idr-trees could be used in this application. Probably the former. (Radix-trees should have been designed from day one to store `unsigned long's, not void*'s, so unless we change that, this application will need to use typecasts when converting between void*'s and the stored BITS_PER_LONG bitmaps).

#16 lore raw
Quoted 18 lines · Andrew Morton
Quoted 9 lines · Rafael J. Wysocki
Quoted 4 lines

I guess I missed this one somehow. Using a bitmap for allocated swap is really inefficient because the values are usually not fragmented much. Extents would have been a far better choice.

I agree it probably may be improved. Still it seems to be good enough. Further, it's more efficient than the previous solution, so I consider it as an improvement. Also this code has been tested for quite some time in -mm and appears to behave properly, at least we haven't got any bug reports related to it so far.

I think that temporarily allocating 1/32768th of total memory here is reasonable, especially as it's not all allocated in a contiguous hunk.

Quoted 3 lines

Currently I'm not working on any better solution. If you can provide any patches to implement one, please submit them, but I think they'll have to be tested for as long as this code, in -mm.

Quoted 6 lines

I was a little saddened by the open-coded approach. I'd expect that both radix-trees and idr-trees could be used in this application. Probably the former. (Radix-trees should have been designed from day one to store `unsigned long's, not void*'s, so unless we change that, this application will need to use typecasts when converting between void*'s and the stored BITS_PER_LONG bitmaps).

Perhaps we can use radix-trees here. Frankly, I haven't investigated this possibility yet, because this part is not very high on my priority list for improvements. :-)

First, I'd like to get the userland suspend out so people can benefit from the userland interface. Second, I think we can save much more memory if we use bitmaps for the image metadata, but that will require a lot of work. Then, there's the problem of the system responsiveness after resume, and the "USB storage not available after resume" problem that I wouldn't like to drop on the floor. Not to mention device driver problems.

Greetings,
Rafael