linux/kernel/power
Rafael J. Wysocki 91e7c75ba9 PM: Allow drivers to allocate memory from .prepare() callbacks safely
If device drivers allocate substantial amounts of memory (above 1 MB)
in their hibernate .freeze() callbacks (or in their legacy suspend
callbcks during hibernation), the subsequent creation of hibernate
image may fail due to the lack of memory.  This is the case, because
the drivers' .freeze() callbacks are executed after the hibernate
memory preallocation has been carried out and the preallocated amount
of memory may be too small to cover the new driver allocations.
Unfortunately, the drivers' .prepare() callbacks also are executed
after the hibernate memory preallocation has completed, so they are
not suitable for allocating additional memory either.  Thus the only
way a driver can safely allocate memory during hibernation is to use
a hibernate/suspend notifier.  However, the notifiers are called
before the freezing of user space and the drivers wanting to use them
for allocating additional memory may not know how much memory needs
to be allocated at that point.

To let device drivers overcome this difficulty rework the hibernation
sequence so that the memory preallocation is carried out after the
drivers' .prepare() callbacks have been executed, so that the
.prepare() callbacks can be used for allocating additional memory
to be used by the drivers' .freeze() callbacks.  Update documentation
to match the new behavior of the code.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
2011-05-17 23:26:00 +02:00
..
block_io.c block: kill off REQ_UNPLUG 2011-03-10 08:52:27 +01:00
console.c vt: introduce and use vt_kmsg_redirect() function 2009-12-15 08:53:28 -08:00
hibernate.c PM: Allow drivers to allocate memory from .prepare() callbacks safely 2011-05-17 23:26:00 +02:00
Kconfig PM: Remove CONFIG_PM_VERBOSE 2011-05-17 23:25:10 +02:00
main.c PM / Hibernate: Add sysfs knob to control size of memory for drivers 2011-05-17 23:19:19 +02:00
Makefile kernel: change to new flag variable 2011-03-17 14:02:54 +01:00
power.h PM / Hibernate: Add sysfs knob to control size of memory for drivers 2011-05-17 23:19:19 +02:00
poweroff.c Input: sysrq - drop tty argument from sysrq ops handlers 2010-08-19 22:07:06 -07:00
process.c workqueue, freezer: unify spelling of 'freeze' + 'able' to 'freezable' 2011-02-16 17:48:59 +01:00
snapshot.c Revert "PM / Hibernate: Reduce autotuned default image size" 2011-05-17 23:19:19 +02: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 Merge branch 'syscore' into for-linus 2011-05-17 23:23:40 +02:00
swap.c Merge branch 'for-2.6.38/core' of git://git.kernel.dk/linux-2.6-block 2011-01-13 10:45:01 -08:00
user.c PM / Hibernate: Fix ioctl SNAPSHOT_S2RAM 2011-05-11 21:10:58 +02:00