linux/kernel/power
KAMEZAWA Hiroyuki d2997b1042 hibernation: freeze swap at hibernation
When taking a memory snapshot in hibernate_snapshot(), all (directly
called) memory allocations use GFP_ATOMIC.  Hence swap misusage during
hibernation never occurs.

But from a pessimistic point of view, there is no guarantee that no page
allcation has __GFP_WAIT.  It is better to have a global indication "we
enter hibernation, don't use swap!".

This patch tries to freeze new-swap-allocation during hibernation.  (All
user processes are frozenm so swapin is not a concern).

This way, no updates will happen to swap_map[] between
hibernate_snapshot() and save_image().  Swap is thawed when swsusp_free()
is called.  We can be assured that swap corruption will not occur.

Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: "Rafael J. Wysocki" <rjw@sisk.pl>
Cc: Hugh Dickins <hughd@google.com>
Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Cc: Ondrej Zary <linux@rainbow-software.org>
Cc: Balbir Singh <balbir@in.ibm.com>
Cc: Andrea Arcangeli <aarcange@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2010-08-09 20:45:04 -07:00
..
block_io.c PM / Hibernate: Fix block_io.c printk warning 2010-05-10 23:08:18 +02:00
console.c vt: introduce and use vt_kmsg_redirect() function 2009-12-15 08:53:28 -08:00
hibernate.c hibernation: freeze swap at hibernation 2010-08-09 20:45:04 -07:00
Kconfig suspend: Move NVS save/restore code to generic suspend functionality 2010-06-10 11:02:34 -04:00
main.c PM: Make it possible to avoid races between wakeup and system sleep 2010-07-19 01:58:48 +02:00
Makefile suspend: Move NVS save/restore code to generic suspend functionality 2010-06-10 11:02:34 -04:00
nvs.c suspend: Move NVS save/restore code to generic suspend functionality 2010-06-10 11:02:34 -04:00
power.h PM / Hibernate: Separate block_io 2010-05-10 23:08:18 +02:00
poweroff.c trivial: kernel/power/poweroff.c: whitespace fix 2009-06-12 18:01:46 +02:00
process.c workqueue: reimplement workqueue freeze using max_active 2010-06-29 10:07:12 +02:00
snapshot.c hibernation: freeze swap at hibernation 2010-08-09 20:45:04 -07:00
suspend_test.c PM: Make warning in suspend_test_finish() less likely to happen 2009-10-22 08:23:45 +09:00
suspend.c PM / Suspend: Fix ordering of calls in suspend error paths 2010-07-19 02:00:35 +02:00
swap.c hibernation: freeze swap at hibernation 2010-08-09 20:45:04 -07:00
user.c PM / Hibernate: Snapshot cleanup 2010-05-10 23:08:17 +02:00