Skip to contentSkip to conversation

2.6.9-rc2-mm1 swsusp bug report.

DISCUSSION Kevin Fenzi 8 participants 21 messages Sep 24, 2004 – Sep 27, 2004

lore
Share & tools
lore
#0 lore raw

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Was trying to swsusp my 2.6.9-rc2-mm1 laptop tonight. It churned for a while, but didn't hibernate. Here are the messages.

I do have PREEMPT and HIMEM enabled.

Sep 23 16:53:37 voldemort kernel: Stopping tasks: ==================================================
=================================================|
Sep 23 16:53:37 voldemort kernel: Freeing memory...  ^H-^H\^H|^H/^H-^H\^H|^H/^H-^H\^H|^H/^H-^H\^H|^H

/^H-^H\^H|^H/^H-^H\^H|^H/^H-^H\^H|^H/^H-^H\^H|^H/^H-^H\^H|^H/^H-^H\^H|^H/^H-^H\^H|^H/^H-^H\^H|^H/^H- ^H\^H|^H/^H-^H\^H|^H/^H-^H\^H|^H/^H-^H\^H|^H/^H-^H\^H|^H/^H-^H\^H|^H/^H-^H\^H|^H/^H-^H\^H|^H/^H-^H\^ H|^H/^H-^H\^H|^H/^H-^H\^H|^H/^H-^H\^H|^H/^H-^H\^H|^H/^H-^H\^H|^H/^H-^H\^H|^H/^H-^H\^H|^H/^H-^H\^H|^H /^H-^H\^H|^H/^H-^H\^H|^H/^H-^H\^H|^H/^H-^H\^H|^H/^H-^H\^H|^H/^H-^H\^H|^H/^H-^H\^H|^H/^H-^H\^H|^H/^H- ^H\^H|^H/^H-^H\^H|^H/^H-^H\^H|^H/^H-^H\^H|^H/^H-^H\^H|^H/^H-^H\^H|^H/^H-^H\^H|^H/^H-^H\^H|^H/^H-^H\^ H|^H/^H-^H\^H|^H/^H-^H\^H|^H/^H-^H\^H|^H/^H-^H\^H|^H/^H-^H\^H|^H/^H-^H\^H|^H/^H-^H\^H|^H/^H-^H\^H|^H /^H-^H\^H|^H/^H-^H\^H|^H/^H-^H\^H|^H/^H-^H\^H|^H/^H-^H\^H|^H/^H-^H\^H|^H/^H-^H\^H|^H/^H-^H\^H|^H/^H- ^H\^H|^H/^H-^H\^H|^H/^H-^H\^H|^H/^H-^H\^H|^H/^H-^H\^H|^H/^H-^H\^H|^H/^H-^H\^H|^H/^H-^H\^H|^H/^H-^H\^ H|^H/^H-^H\^H|^H/^H-^H\^H|^H/^H-^H\^H|^H/^H-^H\^H|^H/^H-^H\^H|^H/^H-^H\^H|^H/^H-^H\^H|^H/^H-^H\^H|^H /^H-^H\^H|^H/^H-^H\^H|^H/^H-^H\

Sep 23 16:53:37 voldemort kernel: ..................................................................
....................................................................................................
.........................swsusp: Need to copy 34850 pages
Sep 23 16:53:37 voldemort kernel: hibernate: page allocation failure. order:8, mode:0x120
Sep 23 16:53:37 voldemort kernel:  [<c013fc1e>] __alloc_pages+0x21e/0x3e0
Sep 23 16:53:37 voldemort kernel:  [<c013fe05>] __get_free_pages+0x25/0x3f
Sep 23 16:53:37 voldemort kernel:  [<c01373b5>] alloc_pagedir+0x1f/0x6b
Sep 23 16:53:37 voldemort kernel:  [<c01374e3>] swsusp_alloc+0x2c/0x62
Sep 23 16:53:37 voldemort kernel:  [<c0137549>] suspend_prepare_image+0x30/0x6e
Sep 23 16:53:37 voldemort kernel:  [<c0284fea>] swsusp_arch_suspend+0x2a/0x2c
Sep 23 16:53:37 voldemort kernel:  [<c01375d5>] swsusp_suspend+0x24/0x33
Sep 23 16:53:37 voldemort kernel:  [<c01379c2>] pm_suspend_disk+0x28/0x7e
Sep 23 16:53:37 voldemort kernel:  [<c0135fd0>] enter_state+0x91/0x95
Sep 23 16:53:39 voldemort kernel:  [<c013fc30>] __alloc_pages+0x230/0x3e0
Sep 23 16:53:39 voldemort kernel:  [<c01360fb>] state_store+0xb1/0xc8
Sep 23 16:53:39 voldemort kernel:  [<c0192748>] subsys_attr_store+0x3a/0x3e
Sep 23 16:53:39 voldemort kernel:  [<c01929ce>] flush_write_buffer+0x3e/0x4a
Sep 23 16:53:39 voldemort kernel:  [<c0192a5c>] sysfs_write_file+0x82/0x98
Sep 23 16:53:39 voldemort kernel:  [<c01929da>] sysfs_write_file+0x0/0x98
Sep 23 16:53:39 voldemort kernel:  [<c015926d>] vfs_write+0xd0/0x135
Sep 23 16:53:39 voldemort kernel:  [<c015882b>] filp_close+0x59/0x86
Sep 23 16:53:39 voldemort kernel:  [<c01593a3>] sys_write+0x51/0x80
Sep 23 16:53:39 voldemort kernel:  [<c0106019>] sysenter_past_esp+0x52/0x71
Sep 23 16:53:39 voldemort kernel: swsusp: Restoring Highmem
Sep 23 16:53:39 voldemort kernel: ACPI: PCI interrupt 0000:00:1f.1[A] -> GSI 11 (level, low) -> IRQ
11
Sep 23 16:53:39 voldemort kernel: ACPI: PCI interrupt 0000:00:1f.5[B] -> GSI 5 (level, low) -> IRQ 5
Sep 23 16:53:39 voldemort kernel: PCI: Setting latency timer of device 0000:00:1f.5 to 64
Sep 23 16:53:39 voldemort kernel: Restarting tasks... done

kevin
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)
Comment: Processed by Mailcrypt 3.5.8 <http://mailcrypt.sourceforge.net/>

iD8DBQFBU4RM3imCezTjY0ERAgEQAJ4qj2PmNsL/5ao+3swoOxioop7G1gCeLLUg ZOWJKH6q3k9UMG8xaYDGLx0=
=Csmg
-----END PGP SIGNATURE-----

#1 lore raw

Hi!

Quoted 7 lines

Was trying to swsusp my 2.6.9-rc2-mm1 laptop tonight. It churned for a while, but didn't hibernate. Here are the messages.

....................................................................................................
.........................swsusp: Need to copy 34850 pages

Sep 23 16:53:37 voldemort kernel: hibernate: page allocation failure. order:8, mode:0x120
Sep 23 16:53:37 voldemort kernel:  

Out of memory... Try again with less loaded system.

Signature · 1 line
64 bytes from 195.113.31.123: icmp_seq=28 ttl=51 time=448769.1 ms         
#2 lore raw

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Pavel" == Pavel Machek <[email protected]> writes:

Pavel> Hi!

Quoted 7 lines
Quoted 7 lines

Was trying to swsusp my 2.6.9-rc2-mm1 laptop tonight. It churned for a while, but didn't hibernate. Here are the messages.

....................................................................................................
.........................swsusp: Need to copy 34850 pages Sep 23 16:53:37 voldemort kernel: hibernate: page allocation failure. order:8, mode:0x120 Sep 23 16:53:37 voldemort kernel:

Pavel> Out of memory... Try again with less loaded system.

The system was no more loaded than usual. I have 1GB memory and 4GB of swap defined. I almost never touch swap. It might have been 100mb into the 4Gb of swap when this happened.

What would cause it to be out of memory?
swsup needs to be reliable... rebooting when you are using your memory kinda defeats the purpose of swsusp.

Felipe W Damasio <[email protected]> sent me a patch, but I haven't had a chance to try it yet:

- --- linux-2.6.9-rc2-mm2/kernel/power/swsusp.c.orig 2004-09-23 23:46:49.292975768 -0300
+++ linux-2.6.9-rc2-mm2/kernel/power/swsusp.c 2004-09-24 00:07:01.933626368 -0300
@@ -657,6 +657,9 @@
int diff = 0;
int order = 0;

+ order = get_bitmask_order(SUSPEND_PD_PAGES(nr_copy_pages));
+ nr_copy_pages += 1 << order;
+
do {
diff = get_bitmask_order(SUSPEND_PD_PAGES(nr_copy_pages)) - order; if (diff) {

kevin
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)
Comment: Processed by Mailcrypt 3.5.8 <http://mailcrypt.sourceforge.net/>

iD8DBQFBVI0m3imCezTjY0ERAgI1AJ0VatDEm27SAh2dvS65XwNNpReSEACeNBkn uRXNP9tQcUlEZ1BAKON1nSo=
=3rnm
-----END PGP SIGNATURE-----

#3 lore raw

Hi.

Quoted 15 lines · Kevin Fenzi

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Pavel" == Pavel Machek <[email protected]> writes:

Pavel> Hi!

Quoted 7 lines
Quoted 7 lines

Was trying to swsusp my 2.6.9-rc2-mm1 laptop tonight. It churned for a while, but didn't hibernate. Here are the messages.

....................................................................................................
.........................swsusp: Need to copy 34850 pages Sep 23 16:53:37 voldemort kernel: hibernate: page allocation failure. order:8, mode:0x120 Sep 23 16:53:37 voldemort kernel:

Pavel> Out of memory... Try again with less loaded system.

Quoted 7 lines

The system was no more loaded than usual. I have 1GB memory and 4GB of swap defined. I almost never touch swap. It might have been 100mb into the 4Gb of swap when this happened.

What would cause it to be out of memory?
swsup needs to be reliable... rebooting when you are using your memory kinda defeats the purpose of swsusp.

The problem isn't really that you're out of memory. Rather, the memory is so fragmented that swsusp is unable to get an order 8 allocation in which to store its metadata. There isn't really anything you can do to avoid this issue apart from eating memory (which swsusp is doing anyway).

Regards,

Nigel

#4 lore raw

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Nigel" == Nigel Cunningham <[email protected]> writes:

Quoted 4 lines · Kevin Fenzi
Quoted 4 lines

-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Pavel" == Pavel Machek <[email protected]> writes:

Pavel> Hi!

Quoted 8 lines
Quoted 8 lines
Quoted 4 lines
Quoted 4 lines

Was trying to swsusp my 2.6.9-rc2-mm1 laptop tonight. It churned for a while, but didn't hibernate. Here are the messages.

....................................................................................................

Quoted 2 lines
Quoted 2 lines

.........................swsusp: Need to copy 34850 pages Sep 23 16:53:37 voldemort kernel: hibernate: page allocation >>

failure. order:8, mode:0x120 Sep 23 16:53:37 voldemort kernel:

Pavel> Out of memory... Try again with less loaded system.

Quoted 7 lines
Quoted 7 lines

The system was no more loaded than usual. I have 1GB memory and 4GB of swap defined. I almost never touch swap. It might have been 100mb into the 4Gb of swap when this happened.

What would cause it to be out of memory? swsup needs to be reliable... rebooting when you are using your memory kinda defeats the purpose of swsusp.

Nigel> The problem isn't really that you're out of memory. Rather, the Nigel> memory is so fragmented that swsusp is unable to get an order 8 Nigel> allocation in which to store its metadata. There isn't really Nigel> anything you can do to avoid this issue apart from eating Nigel> memory (which swsusp is doing anyway).

Odd. I have never run into this before with either swsusp2 or swsusp1.

What causes memory to be so fragmented?
Nothing can be done to prevent it?

Nigel> Regards,
Nigel> Nigel

kevin

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)
Comment: Processed by Mailcrypt 3.5.8 <http://mailcrypt.sourceforge.net/>

iD8DBQFBVM3K3imCezTjY0ERAh75AJ43eMOWlXc2HFQGhTBfgO9G+nI8tACgl7t9 bc6Lo+2guz9WRcu5FhInWMc=
=hunr
-----END PGP SIGNATURE-----

#5 lore raw

Hi.

Quoted 8 lines · Kevin Fenzi

Nigel> The problem isn't really that you're out of memory. Rather, the Nigel> memory is so fragmented that swsusp is unable to get an order 8 Nigel> allocation in which to store its metadata. There isn't really Nigel> anything you can do to avoid this issue apart from eating Nigel> memory (which swsusp is doing anyway).

Odd. I have never run into this before with either swsusp2 or swsusp1.

You won't run into it with suspend2 because it doesn't use high order allocations. There might be one exception, but apart from that, all of suspend2's data is stored in order zero allocated pages, so fragmentation is not an issue. This is the real solution to the problem. I had to do it this way because I aim to have suspend work without eating any memory.

Quoted 1 line

What causes memory to be so fragmented?

Normal usage; the pattern of pages being freed and allocated inevitably leads to fragmentation. The buddy allocator does a good job of minimising it, but what is really needed is a run-time defragmenter. I saw mention of this recently, but it's probably not that practical to implement IMHO.

Quoted 1 line

Nothing can be done to prevent it?

Apart from the above, no, sorry.

Regards,

Nigel

Signature · 7 lines
Nigel Cunningham
Pastoral Worker
Christian Reformed Church of Tuggeranong
PO Box 1004, Tuggeranong, ACT 2901

Many today claim to be tolerant. True tolerance, however, can cope with others
being intolerant.
#6 lore raw
Quoted 4 lines · Nigel Cunningham

Hi.

On Sat, 2004-09-25 at 11:45, Kevin Fenzi wrote:

Quoted 9 lines
Quoted 1 line

What causes memory to be so fragmented?

Normal usage; the pattern of pages being freed and allocated inevitably leads to fragmentation. The buddy allocator does a good job of minimising it, but what is really needed is a run-time defragmenter. I saw mention of this recently, but it's probably not that practical to implement IMHO.

Well, by this stage it looks like memory is already pretty well shrunk as much as it is going to be, which means that even a pretty capable defragmenter won't be able to do anything.

#7 lore raw

Hi.

Quoted 15 lines · Nick Piggin
Quoted 4 lines · Nigel Cunningham

Hi.

On Sat, 2004-09-25 at 11:45, Kevin Fenzi wrote:

Quoted 9 lines
Quoted 1 line

What causes memory to be so fragmented?

Normal usage; the pattern of pages being freed and allocated inevitably leads to fragmentation. The buddy allocator does a good job of minimising it, but what is really needed is a run-time defragmenter. I saw mention of this recently, but it's probably not that practical to implement IMHO.

Quoted 3 lines

Well, by this stage it looks like memory is already pretty well shrunk as much as it is going to be, which means that even a pretty capable defragmenter won't be able to do anything.

Surely it would be able to rearrange pages to get a contiguous megabyte? Regardless, not using order 8 allocations seems to me to be a better solution (but then I have a patch to push once I finish my current round of cleanups :>).

Nigel

#8 lore raw
Quoted 6 lines · Nigel Cunningham

Hi.

Quoted 1 line · Nick Piggin
Quoted 6 lines
Quoted 3 lines

Well, by this stage it looks like memory is already pretty well shrunk as much as it is going to be, which means that even a pretty capable defragmenter won't be able to do anything.

Surely it would be able to rearrange pages to get a contiguous megabyte?

For lots of stuff it is just infeasable. Just about all kernel memory, for example.

But yeah, regardless, really the best thing is not to use such large allocations at all.

#9 lore raw
In reply to Nick Piggin
Quoted 6 lines · Nigel Cunningham
Quoted 5 lines

Normal usage; the pattern of pages being freed and allocated inevitably leads to fragmentation. The buddy allocator does a good job of minimising it, but what is really needed is a run-time defragmenter. I saw mention of this recently, but it's probably not that practical to implement IMHO.

Quoted 3 lines · Nick Piggin

Well, by this stage it looks like memory is already pretty well shrunk as much as it is going to be, which means that even a pretty capable defragmenter won't be able to do anything.

For however useful defragmentation may be to make speculative use of physically or virtually contiguous memory more probable to succeed, it can never be made deterministic or even reliable, not even in pageable kernels (which Linux is not). Fallback to allocations no larger than the kernel's internal allocation unit, potentially in tandem with scatter/gather capabilities, is essential.

-- wli

#10 lore raw

Hi.

Quoted 12 lines · William Lee Irwin III
Quoted 6 lines · Nigel Cunningham
Quoted 5 lines

Normal usage; the pattern of pages being freed and allocated inevitably leads to fragmentation. The buddy allocator does a good job of minimising it, but what is really needed is a run-time defragmenter. I saw mention of this recently, but it's probably not that practical to implement IMHO.

Quoted 3 lines · Nick Piggin

Well, by this stage it looks like memory is already pretty well shrunk as much as it is going to be, which means that even a pretty capable defragmenter won't be able to do anything.

Quoted 6 lines

For however useful defragmentation may be to make speculative use of physically or virtually contiguous memory more probable to succeed, it can never be made deterministic or even reliable, not even in pageable kernels (which Linux is not). Fallback to allocations no larger than the kernel's internal allocation unit, potentially in tandem with scatter/gather capabilities, is essential.

I fully agree. That's why I do it :>

Regards,

Nigel

#11 lore raw
In reply to Nick Piggin

Hi.

Quoted 15 lines · Nick Piggin
Quoted 4 lines · Nigel Cunningham

Hi.

On Sat, 2004-09-25 at 11:45, Kevin Fenzi wrote:

Quoted 9 lines
Quoted 1 line

What causes memory to be so fragmented?

Normal usage; the pattern of pages being freed and allocated inevitably leads to fragmentation. The buddy allocator does a good job of minimising it, but what is really needed is a run-time defragmenter. I saw mention of this recently, but it's probably not that practical to implement IMHO.

Quoted 3 lines

Well, by this stage it looks like memory is already pretty well shrunk as much as it is going to be, which means that even a pretty capable defragmenter won't be able to do anything.

Surely it would be able to rearrange pages to get a contiguous megabyte? Regardless, not using order 8 allocations seems to me to be a better solution (but then I have a barrow^H^H^H^H^H^Hpatch to push once I finish my current round of cleanups :>).

Nigel

#12 lore raw
In reply to Nick Piggin

Hi!

Quoted 9 lines
Quoted 8 lines
Quoted 1 line

What causes memory to be so fragmented?

Normal usage; the pattern of pages being freed and allocated inevitably leads to fragmentation. The buddy allocator does a good job of minimising it, but what is really needed is a run-time defragmenter. I saw mention of this recently, but it's probably not that practical to implement IMHO.

Quoted 3 lines

Well, by this stage it looks like memory is already pretty well shrunk as much as it is going to be, which means that even a pretty capable defragmenter won't be able to do anything.

True, defragmenter would not help.

Anyway, conversion from order-8 allocation should be pretty easy, but I never seen that failure case and this is first report... So I'm not doing that work just yet. [There's big chunk of changes waiting in -mm, that needs to be merged because any other work should be done.]

Pavel

Signature · 2 lines
People were complaining that M$ turns users into beta-testers...
...jr ghea gurz vagb qrirybcref, naq gurl frrz gb yvxr vg gung jnl!
#13 lore raw

Hi.

Quoted 15 lines · Pavel Machek

Hi!

Quoted 9 lines
Quoted 8 lines
Quoted 1 line

What causes memory to be so fragmented?

Normal usage; the pattern of pages being freed and allocated inevitably leads to fragmentation. The buddy allocator does a good job of minimising it, but what is really needed is a run-time defragmenter. I saw mention of this recently, but it's probably not that practical to implement IMHO.

Quoted 3 lines

Well, by this stage it looks like memory is already pretty well shrunk as much as it is going to be, which means that even a pretty capable defragmenter won't be able to do anything.

Quoted 6 lines

True, defragmenter would not help.

Anyway, conversion from order-8 allocation should be pretty easy, but I never seen that failure case and this is first report... So I'm not doing that work just yet. [There's big chunk of changes waiting in -mm, that needs to be merged because any other work should be done.]

Are we still planning on having suspend2 replace swsusp eventually? It was a lot of work to switch from those high order allocations, and if we are still going to replace swsusp, perhaps it's would be a better use of your time to do other things?

Regards,

Nigel

#14 lore raw

Hi!

Quoted 11 lines
Quoted 6 lines

True, defragmenter would not help.

Anyway, conversion from order-8 allocation should be pretty easy, but I never seen that failure case and this is first report... So I'm not doing that work just yet. [There's big chunk of changes waiting in -mm, that needs to be merged because any other work should be done.]

Are we still planning on having suspend2 replace swsusp eventually? It was a lot of work to switch from those high order allocations, and if we are still going to replace swsusp, perhaps it's would be a better use of your time to do other things?

I do not know if I'm more scared of swsusp1 to kill order-8 allocations or if suspend2's two page sets scare me more. (Hooks suspend2 needs to stop all page cache activity are scary...)

I certainly want some parts of suspend2 (like improved freezer, if it can be made small enough), but I'm no longer sure I want all of it. I expected many people complaining about highmem problems in swsusp1, and that just did not happen; SMP support turned out to be reasonably simple...
Pavel

Signature · 2 lines
People were complaining that M$ turns users into beta-testers...
...jr ghea gurz vagb qrirybcref, naq gurl frrz gb yvxr vg gung jnl!
#15 lore raw

Hi.

Quoted 8 lines · Pavel Machek
Quoted 4 lines

Are we still planning on having suspend2 replace swsusp eventually? It was a lot of work to switch from those high order allocations, and if we are still going to replace swsusp, perhaps it's would be a better use of your time to do other things?

I do not know if I'm more scared of swsusp1 to kill order-8 allocations or if suspend2's two page sets scare me more. (Hooks suspend2 needs to stop all page cache activity are scary...)

Hooks to stop all page cache activity? I'm not sure what you mean.

Quoted 5 lines

I certainly want some parts of suspend2 (like improved freezer, if it can be made small enough), but I'm no longer sure I want all of it. I expected many people complaining about highmem problems in swsusp1, and that just did not happen; SMP support turned out to be reasonably simple...

Okay. There are other advantages too, of course :>

Nigel

#16 lore raw

Hi!

Quoted 10 lines
Quoted 8 lines
Quoted 4 lines

Are we still planning on having suspend2 replace swsusp eventually? It was a lot of work to switch from those high order allocations, and if we are still going to replace swsusp, perhaps it's would be a better use of your time to do other things?

I do not know if I'm more scared of swsusp1 to kill order-8 allocations or if suspend2's two page sets scare me more. (Hooks suspend2 needs to stop all page cache activity are scary...)

Hooks to stop all page cache activity? I'm not sure what you mean.

You have system where you write image in two parts, and there are some pretty special rules what you may not touch when writing first part, IIRC. That is what scares me...
Pavel

Signature · 2 lines
People were complaining that M$ turns users into beta-testers...
...jr ghea gurz vagb qrirybcref, naq gurl frrz gb yvxr vg gung jnl!
#17 lore raw

Hi.

Quoted 3 lines · Pavel Machek

You have system where you write image in two parts, and there are some pretty special rules what you may not touch when writing first part, IIRC. That is what scares me...

No special rules. It's just the LRU that shouldn't change, and it won't because all other activity is stopped and I'm using direct bio submits to do the reading and writing. I really should get around to finishing that 'how-it-works' document so I can clear up all the FUD. :>

Nigel

Signature · 7 lines
Nigel Cunningham
Pastoral Worker
Christian Reformed Church of Tuggeranong
PO Box 1004, Tuggeranong, ACT 2901

Many today claim to be tolerant. True tolerance, however, can cope with others
being intolerant.
#18 lore raw
In reply to Nigel Cunningham
Quoted 19 lines · Nigel Cunningham

Hi.

Quoted 8 lines · Kevin Fenzi

Nigel> The problem isn't really that you're out of memory. Rather, the Nigel> memory is so fragmented that swsusp is unable to get an order 8 Nigel> allocation in which to store its metadata. There isn't really Nigel> anything you can do to avoid this issue apart from eating Nigel> memory (which swsusp is doing anyway).

Odd. I have never run into this before with either swsusp2 or swsusp1.

You won't run into it with suspend2 because it doesn't use high order allocations. There might be one exception, but apart from that, all of suspend2's data is stored in order zero allocated pages, so fragmentation is not an issue. This is the real solution to the problem. I had to do it this way because I aim to have suspend work without eating any memory.

Quoted 7 lines
Quoted 1 line

What causes memory to be so fragmented?

Normal usage; the pattern of pages being freed and allocated inevitably leads to fragmentation. The buddy allocator does a good job of minimising it, but what is really needed is a run-time defragmenter. I saw mention of this recently, but it's probably not that practical to implement IMHO.

I think it is possible to have a defragmenter: allocate new page, invalidate mapped pte's, invalidate radix tree entry (and block radix lookups),` copy data from oldpage to newpage, remap pte's, insert radix tree entry, free oldpage.

The memory hotplug patches do it - I'm trying to implement a similar version to free physically nearby pages and form high order pages.

#19 lore raw

Hi!

Quoted 8 lines
Quoted 7 lines
Quoted 1 line

What causes memory to be so fragmented?

Normal usage; the pattern of pages being freed and allocated inevitably leads to fragmentation. The buddy allocator does a good job of minimising it, but what is really needed is a run-time defragmenter. I saw mention of this recently, but it's probably not that practical to implement IMHO.

Quoted 7 lines

I think it is possible to have a defragmenter: allocate new page, invalidate mapped pte's, invalidate radix tree entry (and block radix lookups),` copy data from oldpage to newpage, remap pte's, insert radix tree entry, free oldpage.

The memory hotplug patches do it - I'm trying to implement a similar version to free physically nearby pages and form high order pages.

Well, swsusp is kind of special case. If it is possible to swap that page out or discard, it is swapped out/discarded already. What remains are things like kmalloc(), and you can't move them...

Anyway solution for swsusp is to avoid using such big pages, it is less complex than doing defragmenter.
Pavel

Signature · 2 lines
People were complaining that M$ turns users into beta-testers...
...jr ghea gurz vagb qrirybcref, naq gurl frrz gb yvxr vg gung jnl!
#20 lore raw
In reply to Kevin Fenzi

Hi!

Quoted 9 lines
Quoted 7 lines
Quoted 7 lines

Was trying to swsusp my 2.6.9-rc2-mm1 laptop tonight. It churned for a while, but didn't hibernate. Here are the messages.

....................................................................................................
.........................swsusp: Need to copy 34850 pages Sep 23 16:53:37 voldemort kernel: hibernate: page allocation failure. order:8, mode:0x120 Sep 23 16:53:37 voldemort kernel:

Pavel> Out of memory... Try again with less loaded system.

Quoted 7 lines

The system was no more loaded than usual. I have 1GB memory and 4GB of swap defined. I almost never touch swap. It might have been 100mb into the 4Gb of swap when this happened.

What would cause it to be out of memory?
swsup needs to be reliable... rebooting when you are using your memory kinda defeats the purpose of swsusp.

Read FAQ.

Quoted 8 lines

Felipe W Damasio <[email protected]> sent me a patch, but I haven't had a chance to try it yet:

- --- linux-2.6.9-rc2-mm2/kernel/power/swsusp.c.orig 2004-09-23 23:46:49.292975768 -0300
+++ linux-2.6.9-rc2-mm2/kernel/power/swsusp.c 2004-09-24 00:07:01.933626368 -0300

Review line 665

Quoted 9 lines
(quoted diff) +3 -0
@@ -657,6 +657,9 @@
 	int diff = 0;
 	int order = 0;
 
+	order = get_bitmask_order(SUSPEND_PD_PAGES(nr_copy_pages));
+	nr_copy_pages += 1 << order;
+
 	do {
 		diff = get_bitmask_order(SUSPEND_PD_PAGES(nr_copy_pages)) - order;
 		if (diff) {

That does not look like it could help. I do not see why this patch should be good thing.
Pavel

Signature · 2 lines
People were complaining that M$ turns users into beta-testers...
...jr ghea gurz vagb qrirybcref, naq gurl frrz gb yvxr vg gung jnl!