swsusp: use GFP_KERNEL for creating basic data structures
Make swsusp call create_basic_memory_bitmaps() before processes are frozen, so that GFP_KERNEL allocations can be made in it. Additionally, ensure that the swsusp's userland interface won't be used while either pm_suspend_disk() or software_resume() is being executed. 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>
This commit is contained in:

committed by
Linus Torvalds

parent
1525a2ad76
commit
0709db6072
@@ -40,21 +40,21 @@ static struct snapshot_data {
|
||||
char platform_suspend;
|
||||
} snapshot_state;
|
||||
|
||||
static atomic_t device_available = ATOMIC_INIT(1);
|
||||
atomic_t snapshot_device_available = ATOMIC_INIT(1);
|
||||
|
||||
static int snapshot_open(struct inode *inode, struct file *filp)
|
||||
{
|
||||
struct snapshot_data *data;
|
||||
|
||||
if (!atomic_add_unless(&device_available, -1, 0))
|
||||
if (!atomic_add_unless(&snapshot_device_available, -1, 0))
|
||||
return -EBUSY;
|
||||
|
||||
if ((filp->f_flags & O_ACCMODE) == O_RDWR) {
|
||||
atomic_inc(&device_available);
|
||||
atomic_inc(&snapshot_device_available);
|
||||
return -ENOSYS;
|
||||
}
|
||||
if(create_basic_memory_bitmaps()) {
|
||||
atomic_inc(&device_available);
|
||||
atomic_inc(&snapshot_device_available);
|
||||
return -ENOMEM;
|
||||
}
|
||||
nonseekable_open(inode, filp);
|
||||
@@ -92,7 +92,7 @@ static int snapshot_release(struct inode *inode, struct file *filp)
|
||||
enable_nonboot_cpus();
|
||||
mutex_unlock(&pm_mutex);
|
||||
}
|
||||
atomic_inc(&device_available);
|
||||
atomic_inc(&snapshot_device_available);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user