aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/power/power.h
diff options
context:
space:
mode:
authorRafael J. Wysocki <rjw@sisk.pl>2006-09-26 02:32:54 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-09-26 11:49:02 -0400
commitb788db79896ef2a5817b9395ad63573b254a6d93 (patch)
tree2ed150c373a6e0ceafb30b5d10ec5eacad39c6c8 /kernel/power/power.h
parent0bcd888d64684f896ffa70c1d16a42b00753c184 (diff)
[PATCH] swsusp: Introduce memory bitmaps
Introduce the memory bitmap data structure and make swsusp use in the suspend phase. The current swsusp's internal data structure is not very efficient from the memory usage point of view, so it seems reasonable to replace it with a data structure that will require less memory, such as a pair of bitmaps. The idea is to use bitmaps that may be allocated as sets of individual pages, so that we can avoid making allocations of order greater than 0. For this reason the memory bitmap structure consists of several linked lists of objects that contain pointers to memory pages with the actual bitmap data. Still, for a typical system all of these lists fit in a single page, so it's reasonable to introduce an additional mechanism allowing us to allocate all of them efficiently without sacrificing the generality of the design. This is done with the help of the chain_allocator structure and associated functions. We need to use two memory bitmaps during the suspend phase of the suspend-resume cycle. One of them is necessary for marking the saveable pages, and the second is used to mark the pages in which to store the copies of them (aka image pages). First, the bitmaps are created and we allocate as many image pages as needed (the corresponding bits in the second bitmap are set as soon as the pages are allocated). Second, the bits corresponding to the saveable pages are set in the first bitmap and the saveable pages are copied to the image pages. Finally, the first bitmap is used to save the kernel virtual addresses of the saveable pages and the second one is used to save the contents of the image pages. Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl> Acked-by: Pavel Machek <pavel@ucw.cz> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'kernel/power/power.h')
-rw-r--r--kernel/power/power.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/kernel/power/power.h b/kernel/power/power.h
index e18ba207e784..6e9e2acc34f8 100644
--- a/kernel/power/power.h
+++ b/kernel/power/power.h
@@ -109,9 +109,10 @@ struct snapshot_handle {
109 */ 109 */
110#define data_of(handle) ((handle).buffer + (handle).buf_offset) 110#define data_of(handle) ((handle).buffer + (handle).buf_offset)
111 111
112extern unsigned int snapshot_additional_pages(struct zone *zone);
112extern int snapshot_read_next(struct snapshot_handle *handle, size_t count); 113extern int snapshot_read_next(struct snapshot_handle *handle, size_t count);
113extern int snapshot_write_next(struct snapshot_handle *handle, size_t count); 114extern int snapshot_write_next(struct snapshot_handle *handle, size_t count);
114int snapshot_image_loaded(struct snapshot_handle *handle); 115extern int snapshot_image_loaded(struct snapshot_handle *handle);
115 116
116#define SNAPSHOT_IOC_MAGIC '3' 117#define SNAPSHOT_IOC_MAGIC '3'
117#define SNAPSHOT_FREEZE _IO(SNAPSHOT_IOC_MAGIC, 1) 118#define SNAPSHOT_FREEZE _IO(SNAPSHOT_IOC_MAGIC, 1)