diff options
Diffstat (limited to 'kernel/power/power.h')
-rw-r--r-- | kernel/power/power.h | 42 |
1 files changed, 18 insertions, 24 deletions
diff --git a/kernel/power/power.h b/kernel/power/power.h index 33bd94ceba32..34b43542785a 100644 --- a/kernel/power/power.h +++ b/kernel/power/power.h | |||
@@ -14,8 +14,18 @@ struct swsusp_info { | |||
14 | 14 | ||
15 | 15 | ||
16 | #ifdef CONFIG_SOFTWARE_SUSPEND | 16 | #ifdef CONFIG_SOFTWARE_SUSPEND |
17 | extern int pm_suspend_disk(void); | 17 | /* |
18 | * Keep some memory free so that I/O operations can succeed without paging | ||
19 | * [Might this be more than 4 MB?] | ||
20 | */ | ||
21 | #define PAGES_FOR_IO ((4096 * 1024) >> PAGE_SHIFT) | ||
22 | /* | ||
23 | * Keep 1 MB of memory free so that device drivers can allocate some pages in | ||
24 | * their .suspend() routines without breaking the suspend to disk. | ||
25 | */ | ||
26 | #define SPARE_PAGES ((1024 * 1024) >> PAGE_SHIFT) | ||
18 | 27 | ||
28 | extern int pm_suspend_disk(void); | ||
19 | #else | 29 | #else |
20 | static inline int pm_suspend_disk(void) | 30 | static inline int pm_suspend_disk(void) |
21 | { | 31 | { |
@@ -48,6 +58,8 @@ extern sector_t swsusp_resume_block; | |||
48 | extern asmlinkage int swsusp_arch_suspend(void); | 58 | extern asmlinkage int swsusp_arch_suspend(void); |
49 | extern asmlinkage int swsusp_arch_resume(void); | 59 | extern asmlinkage int swsusp_arch_resume(void); |
50 | 60 | ||
61 | extern int create_basic_memory_bitmaps(void); | ||
62 | extern void free_basic_memory_bitmaps(void); | ||
51 | extern unsigned int count_data_pages(void); | 63 | extern unsigned int count_data_pages(void); |
52 | 64 | ||
53 | /** | 65 | /** |
@@ -138,30 +150,12 @@ struct resume_swap_area { | |||
138 | #define PMOPS_ENTER 2 | 150 | #define PMOPS_ENTER 2 |
139 | #define PMOPS_FINISH 3 | 151 | #define PMOPS_FINISH 3 |
140 | 152 | ||
141 | /** | 153 | /* If unset, the snapshot device cannot be open. */ |
142 | * The bitmap is used for tracing allocated swap pages | 154 | extern atomic_t snapshot_device_available; |
143 | * | ||
144 | * The entire bitmap consists of a number of bitmap_page | ||
145 | * structures linked with the help of the .next member. | ||
146 | * Thus each page can be allocated individually, so we only | ||
147 | * need to make 0-order memory allocations to create | ||
148 | * the bitmap. | ||
149 | */ | ||
150 | |||
151 | #define BITMAP_PAGE_SIZE (PAGE_SIZE - sizeof(void *)) | ||
152 | #define BITMAP_PAGE_CHUNKS (BITMAP_PAGE_SIZE / sizeof(long)) | ||
153 | #define BITS_PER_CHUNK (sizeof(long) * 8) | ||
154 | #define BITMAP_PAGE_BITS (BITMAP_PAGE_CHUNKS * BITS_PER_CHUNK) | ||
155 | |||
156 | struct bitmap_page { | ||
157 | unsigned long chunks[BITMAP_PAGE_CHUNKS]; | ||
158 | struct bitmap_page *next; | ||
159 | }; | ||
160 | 155 | ||
161 | extern void free_bitmap(struct bitmap_page *bitmap); | 156 | extern sector_t alloc_swapdev_block(int swap); |
162 | extern struct bitmap_page *alloc_bitmap(unsigned int nr_bits); | 157 | extern void free_all_swap_pages(int swap); |
163 | extern sector_t alloc_swapdev_block(int swap, struct bitmap_page *bitmap); | 158 | extern int swsusp_swap_in_use(void); |
164 | extern void free_all_swap_pages(int swap, struct bitmap_page *bitmap); | ||
165 | 159 | ||
166 | extern int swsusp_check(void); | 160 | extern int swsusp_check(void); |
167 | extern int swsusp_shrink_memory(void); | 161 | extern int swsusp_shrink_memory(void); |