summaryrefslogtreecommitdiff
path: root/kernel/power/hibernate.c
diff options
context:
space:
mode:
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>2013-08-30 16:19:46 +0400
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2013-08-31 04:49:47 +0400
commit942f40155a743f4204308d62405dacaa4bfadb11 (patch)
treec65e934016413151824dcb6b15e0f2ae6ce1d23d /kernel/power/hibernate.c
parent8fd37a4c9822d58c93f764864582aa13112b1513 (diff)
downloadlinux-942f40155a743f4204308d62405dacaa4bfadb11.tar.xz
PM / hibernate / memory hotplug: Rework mutual exclusion
Since all of the memory hotplug operations have to be carried out under device_hotplug_lock, they won't need to acquire pm_mutex if device_hotplug_lock is held around hibernation. For this reason, make the hibernation code acquire device_hotplug_lock after freezing user space processes and release it before thawing them. At the same tim drop the lock_system_sleep() and unlock_system_sleep() calls from lock_memory_hotplug() and unlock_memory_hotplug(), respectively. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Acked-by: Toshi Kani <toshi.kani@hp.com>
Diffstat (limited to 'kernel/power/hibernate.c')
-rw-r--r--kernel/power/hibernate.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/kernel/power/hibernate.c b/kernel/power/hibernate.c
index d4e54053d009..0b78f72ad39d 100644
--- a/kernel/power/hibernate.c
+++ b/kernel/power/hibernate.c
@@ -652,6 +652,7 @@ int hibernate(void)
if (error)
goto Exit;
+ lock_device_hotplug();
/* Allocate memory management structures */
error = create_basic_memory_bitmaps();
if (error)
@@ -685,6 +686,7 @@ int hibernate(void)
Free_bitmaps:
free_basic_memory_bitmaps();
Thaw:
+ unlock_device_hotplug();
thaw_processes();
/* Don't bother checking whether freezer_test_done is true */
@@ -814,6 +816,7 @@ static int software_resume(void)
pr_debug("PM: Loading hibernation image.\n");
+ lock_device_hotplug();
error = create_basic_memory_bitmaps();
if (error)
goto Thaw;
@@ -827,6 +830,7 @@ static int software_resume(void)
swsusp_free();
free_basic_memory_bitmaps();
Thaw:
+ unlock_device_hotplug();
thaw_processes();
Finish:
pm_notifier_call_chain(PM_POST_RESTORE);