diff options
author | Rafael J. Wysocki <rjw@sisk.pl> | 2010-03-05 16:42:13 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-03-06 14:26:26 -0500 |
commit | 452aa6999e6703ffbddd7f6ea124d3968915f3e3 (patch) | |
tree | 48e375fdb60920675f68b444b462903ad8bb6940 /kernel/power/suspend.c | |
parent | ad2bd7e0e9647cd48593a6b3a2be07dc2c2d28ed (diff) |
mm/pm: force GFP_NOIO during suspend/hibernation and resume
There are quite a few GFP_KERNEL memory allocations made during
suspend/hibernation and resume that may cause the system to hang, because
the I/O operations they depend on cannot be completed due to the
underlying devices being suspended.
Avoid this problem by clearing the __GFP_IO and __GFP_FS bits in
gfp_allowed_mask before suspend/hibernation and restoring the original
values of these bits in gfp_allowed_mask durig the subsequent resume.
[akpm@linux-foundation.org: fix CONFIG_PM=n linkage]
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Reported-by: Maxim Levitsky <maximlevitsky@gmail.com>
Cc: Sebastian Ott <sebott@linux.vnet.ibm.com>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'kernel/power/suspend.c')
-rw-r--r-- | kernel/power/suspend.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/kernel/power/suspend.c b/kernel/power/suspend.c index 6f10dfc2d3e9..44cce10b582d 100644 --- a/kernel/power/suspend.c +++ b/kernel/power/suspend.c | |||
@@ -189,6 +189,7 @@ static int suspend_enter(suspend_state_t state) | |||
189 | int suspend_devices_and_enter(suspend_state_t state) | 189 | int suspend_devices_and_enter(suspend_state_t state) |
190 | { | 190 | { |
191 | int error; | 191 | int error; |
192 | gfp_t saved_mask; | ||
192 | 193 | ||
193 | if (!suspend_ops) | 194 | if (!suspend_ops) |
194 | return -ENOSYS; | 195 | return -ENOSYS; |
@@ -199,6 +200,7 @@ int suspend_devices_and_enter(suspend_state_t state) | |||
199 | goto Close; | 200 | goto Close; |
200 | } | 201 | } |
201 | suspend_console(); | 202 | suspend_console(); |
203 | saved_mask = clear_gfp_allowed_mask(GFP_IOFS); | ||
202 | suspend_test_start(); | 204 | suspend_test_start(); |
203 | error = dpm_suspend_start(PMSG_SUSPEND); | 205 | error = dpm_suspend_start(PMSG_SUSPEND); |
204 | if (error) { | 206 | if (error) { |
@@ -215,6 +217,7 @@ int suspend_devices_and_enter(suspend_state_t state) | |||
215 | suspend_test_start(); | 217 | suspend_test_start(); |
216 | dpm_resume_end(PMSG_RESUME); | 218 | dpm_resume_end(PMSG_RESUME); |
217 | suspend_test_finish("resume devices"); | 219 | suspend_test_finish("resume devices"); |
220 | set_gfp_allowed_mask(saved_mask); | ||
218 | resume_console(); | 221 | resume_console(); |
219 | Close: | 222 | Close: |
220 | if (suspend_ops->end) | 223 | if (suspend_ops->end) |