[PATCH] swsusp: use non-contiguous memory on resume
The following patch is designed to fix a problem in the current implementation of swsusp in mainline kernels. Namely, swsusp uses an array of page backup entries (aka pagedir) to store pointers to memory pages that must be saved during suspend and restored during resume. Unfortunately, the pagedir has to be located in a contiguous chunk of memory and it sometimes turns out that an 8-order or even 9-order allocation is needed for this purpose. It sometimes is impossible to get such an allocation and swsusp may fail during either suspend or resume due to the lack of memory, although theoretically there is enough free memory for it to succeed. Moreover, swsusp is more likely to fail for this reason during resume, which means that it may fail during resume after a successful suspend (this actually has happened for some people, including me :-)) and this, potentially, may lead to the loss of data. The problem is fixed by replacing the pagedir with a linklist so that high-order memory allocations are avoided (the patches make swsusp use only 0-order allocations). Unfortunately this means that it's necessary to change assembly routines used to restore the image after it's been loaded from swap so that they walk the list instead of walking the array. This patch makes swsusp allocate only individual pages during resume. it contains the necessary changes to the assembly routines etc. for i386 and x86-64. Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl> Signed-off-by: Pavel Machek <pavel@suse.cz> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Showing
This diff is collapsed.
Please register or sign in to comment