aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/power/power.h
diff options
context:
space:
mode:
authorRafael J. Wysocki <rjw@sisk.pl>2007-05-06 17:50:47 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-05-07 15:12:59 -0400
commitd1d241cc2c5feec057c370aa71637380b1b945d5 (patch)
tree69c07d4c7a8b52b9ee6efba1511f3b4f8f79e6bb /kernel/power/power.h
parent726162b5dad154a90dad51c0185b891312de5757 (diff)
swsusp: use rbtree for tracking allocated swap
Make swsusp use extents instead of a bitmap to trace swap pages allocated for saving the image (the tracking is only needed in case there's an error, so that the allocated swap pages can be released). This should allow us to reduce the memory usage, practically always, and improve performance. Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl> Cc: Nigel Cunningham <nigel@nigel.suspend2.net> Cc: Pavel Machek <pavel@ucw.cz> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'kernel/power/power.h')
-rw-r--r--kernel/power/power.h27
1 files changed, 3 insertions, 24 deletions
diff --git a/kernel/power/power.h b/kernel/power/power.h
index a64d3f22de97..a3e47cbdaf31 100644
--- a/kernel/power/power.h
+++ b/kernel/power/power.h
@@ -143,30 +143,9 @@ struct resume_swap_area {
143/* If unset, the snapshot device cannot be open. */ 143/* If unset, the snapshot device cannot be open. */
144extern atomic_t snapshot_device_available; 144extern atomic_t snapshot_device_available;
145 145
146/** 146extern sector_t alloc_swapdev_block(int swap);
147 * The bitmap is used for tracing allocated swap pages 147extern void free_all_swap_pages(int swap);
148 * 148extern int swsusp_swap_in_use(void);
149 * The entire bitmap consists of a number of bitmap_page
150 * structures linked with the help of the .next member.
151 * Thus each page can be allocated individually, so we only
152 * need to make 0-order memory allocations to create
153 * the bitmap.
154 */
155
156#define BITMAP_PAGE_SIZE (PAGE_SIZE - sizeof(void *))
157#define BITMAP_PAGE_CHUNKS (BITMAP_PAGE_SIZE / sizeof(long))
158#define BITS_PER_CHUNK (sizeof(long) * 8)
159#define BITMAP_PAGE_BITS (BITMAP_PAGE_CHUNKS * BITS_PER_CHUNK)
160
161struct bitmap_page {
162 unsigned long chunks[BITMAP_PAGE_CHUNKS];
163 struct bitmap_page *next;
164};
165
166extern void free_bitmap(struct bitmap_page *bitmap);
167extern struct bitmap_page *alloc_bitmap(unsigned int nr_bits);
168extern sector_t alloc_swapdev_block(int swap, struct bitmap_page *bitmap);
169extern void free_all_swap_pages(int swap, struct bitmap_page *bitmap);
170 149
171extern int swsusp_check(void); 150extern int swsusp_check(void);
172extern int swsusp_shrink_memory(void); 151extern int swsusp_shrink_memory(void);