Hi Michael, i'm taking Pavel Machek into Cc: as he is one of the main developers of swsusp. He is not on this list so remember to CC him as well. I think he might be interested in this particular problem. BTW: if this gets longer, we might take it off-list to not annoy everyone with voluminous logs and technical details :-) On Fri, Nov 19, 2004 at 12:41:10PM +0100, Michael Karbach wrote:
Is it not sufficient to have 2GB swap for 768RAM? Or is the problem that I have more than 512MB RAM?
The problem is almost always not "not enough swap" but "not enough free memory". I'll take a ride into theory... :-) To suspend, we do the following (this is a bit simplified). 1 Free as much memory as possible by pushing applications into swap 2 stop all processes 3 stop all device drivers, to prevent us from ongoing DMA transfers etc. now the machine is totally calm, nothing is running except the swsusp routine. 4 make an atomic copy of the used memory. 5 restart device drivers 6 write the copy to disk. The "original" may be modified e.g. by DMA transfers etc, this changes get lost. You'll notice this in the syslog or on the console during resume where some of the messages during suspend are not logged - these are the messages displayed _after_ the atomic copy was made. As you can easily see, at point 4), we have to have half of the physical RAM free or we cannot make the atomic copy. -> this is what happened to you.
Below you see all my suspend/resume cycles. As you can see till Nov 12 everything has worked pretty well. At this date I have made the you-update, and have followed your advice to remove the second swap-partition. From that next reboot the problem emerged. Up to 17 Nov when I haved added the second swap-partition. From that day on everything works again:-)
And this is where it gets very interesting. Can you also grep through your logs for the number of pages that were freed ("Freeing memory... XXX pages freed") at each of these occasions? I _think_ that your machine fails to free enough pages to suspend successfully if it only has one partition and although i have no idea why, this list would confirm at least my theory. Short summary for Pavel (Michael correct me if i am wrong :-): Michael has 768MB RAM and 2GB swap. Originally he had 3GB swap (2+1) and i told him this was probably a bad idea and he should drop one of the swap partition. Since then, suspend often fails with not enough free memory, the original case was: : Freeing memory... done (17088 pages freed) : PM: Attempting to suspend to disk. : PM: snapshotting memory. : swsusp: critical section: : swsusp: Saving Highmem : [nosave pfn 0x3be]<7>[nosave pfn 0x3bf]swsusp: Need to copy 131684 pages : suspend: (pages needed: 131684 + 512 free: 64892) : swsusp: Not enough free pages: Have 64892 : swsusp: Restoring Highmem after readding the second swap partition, it works better again. The question is: what bad consequences may arise from the second swap partition? Is the "you shall have only one swap partition!"-dogma still true? Does it work by accident or is this safe now?
There are some suspend/resume cycles in between (recognizable by the small numer of needed pages) where the system has suspend well, but in all those occasions there was no one logged in KDE.
Best regards,
Michael
Oct 30 10:18:16 wptnb8 kernel: Need to copy 12371 pages Oct 30 11:48:30 wptnb8 kernel: Need to copy 23529 pages Oct 30 21:21:19 wptnb8 kernel: Need to copy 21714 pages Oct 31 16:53:04 wptnb8 kernel: Need to copy 24670 pages Oct 31 19:44:46 wptnb8 kernel: Need to copy 35168 pages Oct 31 19:51:26 wptnb8 kernel: Need to copy 14550 pages Oct 31 19:59:23 wptnb8 kernel: Need to copy 19484 pages Nov 1 20:37:12 wptnb8 kernel: Need to copy 28779 pages Nov 2 07:28:33 wptnb8 kernel: Need to copy 31191 pages Nov 2 12:34:32 wptnb8 kernel: Need to copy 23718 pages Nov 2 15:39:15 wptnb8 kernel: Need to copy 26984 pages Nov 2 21:17:55 wptnb8 kernel: Need to copy 27618 pages Nov 3 08:29:49 wptnb8 kernel: Need to copy 14803 pages Nov 3 16:45:43 wptnb8 kernel: Need to copy 30395 pages Nov 3 22:16:29 wptnb8 kernel: Need to copy 31487 pages Nov 4 11:09:21 wptnb8 kernel: Need to copy 18131 pages Nov 4 16:37:02 wptnb8 kernel: Need to copy 28242 pages Nov 4 21:30:59 wptnb8 kernel: Need to copy 34134 pages Nov 5 21:15:38 wptnb8 kernel: Need to copy 36417 pages Nov 5 21:39:29 wptnb8 kernel: Need to copy 19842 pages Nov 6 21:26:00 wptnb8 kernel: Need to copy 33096 pages Nov 6 21:31:55 wptnb8 kernel: Need to copy 14773 pages Nov 7 08:41:09 wptnb8 kernel: Need to copy 33680 pages Nov 7 20:42:53 wptnb8 kernel: Need to copy 33339 pages Nov 7 21:10:52 wptnb8 kernel: Need to copy 18196 pages Nov 8 12:42:49 wptnb8 kernel: Need to copy 32474 pages Nov 8 12:47:30 wptnb8 kernel: Need to copy 18039 pages Nov 8 16:56:27 wptnb8 kernel: Need to copy 14975 pages Nov 8 21:16:50 wptnb8 kernel: Need to copy 33602 pages Nov 9 10:30:47 wptnb8 kernel: Need to copy 34851 pages Nov 9 10:39:10 wptnb8 kernel: Need to copy 17907 pages Nov 9 11:00:06 wptnb8 kernel: Need to copy 27107 pages Nov 9 20:52:56 wptnb8 kernel: Need to copy 19605 pages Nov 10 08:21:50 wptnb8 kernel: Need to copy 22570 pages Nov 10 08:42:45 wptnb8 kernel: Need to copy 17281 pages Nov 10 15:40:48 wptnb8 kernel: Need to copy 17177 pages Nov 10 21:25:55 wptnb8 kernel: Need to copy 19270 pages Nov 11 07:31:55 wptnb8 kernel: Need to copy 21397 pages Nov 11 07:47:52 wptnb8 kernel: Need to copy 18353 pages Nov 11 17:48:14 wptnb8 kernel: Need to copy 19332 pages Nov 11 21:05:01 wptnb8 kernel: Need to copy 20666 pages Nov 12 21:44:42 wptnb8 kernel: Need to copy 170878 pages Nov 12 21:49:19 wptnb8 kernel: Need to copy 161254 pages Nov 12 21:49:57 wptnb8 kernel: Need to copy 160928 pages Nov 12 21:50:57 wptnb8 kernel: Need to copy 161755 pages Nov 12 21:51:41 wptnb8 kernel: Need to copy 161005 pages Nov 13 12:24:04 wptnb8 kernel: Need to copy 145906 pages Nov 13 12:24:43 wptnb8 kernel: Need to copy 145686 pages Nov 13 22:08:20 wptnb8 kernel: Need to copy 148349 pages Nov 13 22:10:06 wptnb8 kernel: Need to copy 148233 pages Nov 13 22:11:00 wptnb8 kernel: Need to copy 147958 pages Nov 13 22:11:41 wptnb8 kernel: Need to copy 148896 pages Nov 13 22:14:26 wptnb8 kernel: Need to copy 149065 pages Nov 13 23:31:15 wptnb8 kernel: Need to copy 42050 pages Nov 14 08:38:15 wptnb8 kernel: Need to copy 146226 pages Nov 14 08:38:53 wptnb8 kernel: Need to copy 146493 pages Nov 14 18:34:24 wptnb8 kernel: Need to copy 27855 pages Nov 14 19:08:45 wptnb8 kernel: Need to copy 27818 pages Nov 14 19:24:22 wptnb8 kernel: Need to copy 131239 pages Nov 14 19:26:27 wptnb8 kernel: Need to copy 131604 pages Nov 14 19:29:02 wptnb8 kernel: Need to copy 131684 pages Nov 14 19:47:13 wptnb8 kernel: Need to copy 140097 pages Nov 14 19:56:27 wptnb8 kernel: Need to copy 121729 pages Nov 14 19:58:14 wptnb8 kernel: Need to copy 122419 pages Nov 14 20:35:52 wptnb8 kernel: Need to copy 122782 pages Nov 14 21:49:14 wptnb8 kernel: Need to copy 38783 pages Nov 14 20:41:40 wptnb8 kernel: Need to copy 51067 pages Nov 14 20:46:42 wptnb8 kernel: Need to copy 120917 pages Nov 14 20:48:24 wptnb8 kernel: Need to copy 121097 pages Nov 14 20:49:04 wptnb8 kernel: Need to copy 121233 pages Nov 14 20:50:16 wptnb8 kernel: Need to copy 121169 pages Nov 14 20:50:54 wptnb8 kernel: Need to copy 121202 pages Nov 14 21:06:51 wptnb8 kernel: Need to copy 38683 pages Nov 14 21:10:35 wptnb8 kernel: Need to copy 123069 pages Nov 14 21:18:11 wptnb8 kernel: Need to copy 111189 pages Nov 14 21:23:30 wptnb8 kernel: Need to copy 112072 pages Nov 14 21:27:02 wptnb8 kernel: Need to copy 105722 pages Nov 14 21:28:36 wptnb8 kernel: Need to copy 104933 pages Nov 14 21:32:40 wptnb8 kernel: Need to copy 86330 pages Nov 15 11:46:57 wptnb8 kernel: Need to copy 141656 pages Nov 15 21:50:28 wptnb8 kernel: Need to copy 142392 pages Nov 16 20:44:49 wptnb8 kernel: Need to copy 161256 pages Nov 16 21:48:03 wptnb8 kernel: Need to copy 158536 pages Nov 17 08:32:00 wptnb8 kernel: Need to copy 43310 pages Nov 17 08:56:13 wptnb8 kernel: Need to copy 23716 pages Nov 17 16:33:33 wptnb8 kernel: Need to copy 42589 pages Nov 17 21:33:22 wptnb8 kernel: Need to copy 24823 pages Nov 18 07:28:50 wptnb8 kernel: Need to copy 17285 pages Nov 18 14:25:22 wptnb8 kernel: Need to copy 26994 pages Nov 18 21:04:48 wptnb8 kernel: Need to copy 25490 pages
just as a reference, here are the values from my machine (a thinkpad T40p, 512MB RAM, 1G swap, freshly installed on monday, so not too many suspend cycles yet): seife@susi:~> awk -F "done " '/Freeing memory/ {print $2}' /var/log/messages (101260 pages freed) (42729 pages freed) (18916 pages freed) (18731 pages freed) (108703 pages freed) (79709 pages freed) (25728 pages freed) (98369 pages freed) (96047 pages freed) (91920 pages freed) seife@susi:~> awk -F swsusp: '/Need to copy/ {print $2}' /var/log/messages Need to copy 13699 pages Need to copy 13808 pages Need to copy 11292 pages Need to copy 12307 pages Need to copy 13956 pages Need to copy 16682 pages Need to copy 14834 pages Need to copy 14256 pages Need to copy 12727 pages Need to copy 17815 pages Need to copy 37693 pages so you see that my numbers are clearly different from yours, much more freed and less to copy although i am almost always logged into KDE when suspending (although not too many applications are running). A last question Michael: did you do any "VM tuning" or are you running some database-server software (they are known for sometimes doing this in their start scripts)? This would be one way to explain the behaviour. -- Stefan Seyfried