summaryrefslogtreecommitdiffstats
path: root/kernel/power/user.c
diff options
context:
space:
mode:
authorRafael J. Wysocki <rjw@sisk.pl>2007-05-06 23:50:43 +0200
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-05-07 21:12:59 +0200
commit74dfd666de861c97d47bdbd892f6d21b801d0247 (patch)
tree7200946212cf546f4e5fac31db3dc97dbb144300 /kernel/power/user.c
parentswsusp: use inline functions for changing page flags (diff)
downloadlinux-74dfd666de861c97d47bdbd892f6d21b801d0247.tar.xz
linux-74dfd666de861c97d47bdbd892f6d21b801d0247.zip
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 'kernel/power/user.c')
-rw-r--r--kernel/power/user.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/kernel/power/user.c b/kernel/power/user.c
index 7cf6713b2325..845acd84cb23 100644
--- a/kernel/power/user.c
+++ b/kernel/power/user.c
@@ -52,6 +52,9 @@ static int snapshot_open(struct inode *inode, struct file *filp)
if ((filp->f_flags & O_ACCMODE) == O_RDWR)
return -ENOSYS;
+ if(create_basic_memory_bitmaps())
+ return -ENOMEM;
+
nonseekable_open(inode, filp);
data = &snapshot_state;
filp->private_data = data;
@@ -77,6 +80,7 @@ static int snapshot_release(struct inode *inode, struct file *filp)
struct snapshot_data *data;
swsusp_free();
+ free_basic_memory_bitmaps();
data = filp->private_data;
free_all_swap_pages(data->swap, data->bitmap);
free_bitmap(data->bitmap);