aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorRafael J. Wysocki <rjw@sisk.pl>2007-05-06 17:50:43 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-05-07 15:12:59 -0400
commit74dfd666de861c97d47bdbd892f6d21b801d0247 (patch)
tree7200946212cf546f4e5fac31db3dc97dbb144300 /include/linux
parent7be9823491ecbaf9700d7d3502cb4b4dd0ed868a (diff)
swsusp: do not use page flags
Make swsusp use memory bitmaps instead of page flags for marking 'nosave' and free pages. This allows us to 'recycle' two page flags that can be used for other purposes. Also, the memory needed to store the bitmaps is allocated when necessary (ie. before the suspend) and freed after the resume which is more reasonable. The patch is designed to minimize the amount of changes and there are some nice simplifications and optimizations possible on top of it. I am going to implement them separately in the future. Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl> Acked-by: 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 'include/linux')
-rw-r--r--include/linux/suspend.h58
1 files changed, 18 insertions, 40 deletions
diff --git a/include/linux/suspend.h b/include/linux/suspend.h
index a45b9f514492..3cc4d6394c07 100644
--- a/include/linux/suspend.h
+++ b/include/linux/suspend.h
@@ -24,63 +24,41 @@ struct pbe {
24extern void drain_local_pages(void); 24extern void drain_local_pages(void);
25extern void mark_free_pages(struct zone *zone); 25extern void mark_free_pages(struct zone *zone);
26 26
27#ifdef CONFIG_PM 27#if defined(CONFIG_PM) && defined(CONFIG_VT) && defined(CONFIG_VT_CONSOLE)
28/* kernel/power/swsusp.c */
29extern int software_suspend(void);
30
31#if defined(CONFIG_VT) && defined(CONFIG_VT_CONSOLE)
32extern int pm_prepare_console(void); 28extern int pm_prepare_console(void);
33extern void pm_restore_console(void); 29extern void pm_restore_console(void);
34#else 30#else
35static inline int pm_prepare_console(void) { return 0; } 31static inline int pm_prepare_console(void) { return 0; }
36static inline void pm_restore_console(void) {} 32static inline void pm_restore_console(void) {}
37#endif /* defined(CONFIG_VT) && defined(CONFIG_VT_CONSOLE) */ 33#endif
34
35#if defined(CONFIG_PM) && defined(CONFIG_SOFTWARE_SUSPEND)
36/* kernel/power/swsusp.c */
37extern int software_suspend(void);
38/* kernel/power/snapshot.c */
39extern void __init register_nosave_region(unsigned long, unsigned long);
40extern int swsusp_page_is_forbidden(struct page *);
41extern void swsusp_set_page_free(struct page *);
42extern void swsusp_unset_page_free(struct page *);
43extern unsigned long get_safe_page(gfp_t gfp_mask);
38#else 44#else
39static inline int software_suspend(void) 45static inline int software_suspend(void)
40{ 46{
41 printk("Warning: fake suspend called\n"); 47 printk("Warning: fake suspend called\n");
42 return -ENOSYS; 48 return -ENOSYS;
43} 49}
44#endif /* CONFIG_PM */ 50
51static inline void register_nosave_region(unsigned long b, unsigned long e) {}
52static inline int swsusp_page_is_forbidden(struct page *p) { return 0; }
53static inline void swsusp_set_page_free(struct page *p) {}
54static inline void swsusp_unset_page_free(struct page *p) {}
55#endif /* defined(CONFIG_PM) && defined(CONFIG_SOFTWARE_SUSPEND) */
45 56
46void save_processor_state(void); 57void save_processor_state(void);
47void restore_processor_state(void); 58void restore_processor_state(void);
48struct saved_context; 59struct saved_context;
49void __save_processor_state(struct saved_context *ctxt); 60void __save_processor_state(struct saved_context *ctxt);
50void __restore_processor_state(struct saved_context *ctxt); 61void __restore_processor_state(struct saved_context *ctxt);
51unsigned long get_safe_page(gfp_t gfp_mask);
52
53/* Page management functions for the software suspend (swsusp) */
54
55static inline void swsusp_set_page_forbidden(struct page *page)
56{
57 SetPageNosave(page);
58}
59
60static inline int swsusp_page_is_forbidden(struct page *page)
61{
62 return PageNosave(page);
63}
64
65static inline void swsusp_unset_page_forbidden(struct page *page)
66{
67 ClearPageNosave(page);
68}
69
70static inline void swsusp_set_page_free(struct page *page)
71{
72 SetPageNosaveFree(page);
73}
74
75static inline int swsusp_page_is_free(struct page *page)
76{
77 return PageNosaveFree(page);
78}
79
80static inline void swsusp_unset_page_free(struct page *page)
81{
82 ClearPageNosaveFree(page);
83}
84 62
85/* 63/*
86 * XXX: We try to keep some more pages free so that I/O operations succeed 64 * XXX: We try to keep some more pages free so that I/O operations succeed