07 Dec, 2011

1 commit

  • Commit 2aede851ddf08666f68ffc17be446420e9d2a056 (PM / Hibernate: Freeze
    kernel threads after preallocating memory) moved the freezing of kernel
    threads to hibernation_snapshot() function.

    So now, if the call to hibernation_snapshot() returns early due to a
    successful hibernation test, the caller has to thaw processes to ensure
    that the system gets back to its original state.

    But in SNAPSHOT_CREATE_IMAGE hibernation ioctl, the caller does not thaw
    processes in case hibernation_snapshot() returned due to a successful
    freezer test. Fix this issue. But note we still send the value of 'in_suspend'
    (which is now 0) to userspace, because we are not in an error path per-se,
    and moreover, the value of in_suspend correctly depicts the situation here.

    Signed-off-by: Srivatsa S. Bhat
    Signed-off-by: Rafael J. Wysocki

    Srivatsa S. Bhat
     

17 Oct, 2011

2 commits

  • Use threads for LZO compression/decompression on hibernate/thaw.
    Improve buffering on hibernate/thaw.
    Calculate/verify CRC32 of the image pages on hibernate/thaw.

    In my testing, this improved write/read speed by a factor of about two.

    Signed-off-by: Bojan Smojver
    Signed-off-by: Rafael J. Wysocki

    Bojan Smojver
     
  • There is a problem with the current ordering of hibernate code which
    leads to deadlocks in some filesystems' memory shrinkers. Namely,
    some filesystems use freezable kernel threads that are inactive when
    the hibernate memory preallocation is carried out. Those same
    filesystems use memory shrinkers that may be triggered by the
    hibernate memory preallocation. If those memory shrinkers wait for
    the frozen kernel threads, the hibernate process deadlocks (this
    happens with XFS, for one example).

    Apparently, it is not technically viable to redesign the filesystems
    in question to avoid the situation described above, so the only
    possible solution of this issue is to defer the freezing of kernel
    threads until the hibernate memory preallocation is done, which is
    implemented by this change.

    Unfortunately, this requires the memory preallocation to be done
    before the "prepare" stage of device freeze, so after this change the
    only way drivers can allocate additional memory for their freeze
    routines in a clean way is to use PM notifiers.

    Reported-by: Christoph
    Signed-off-by: Rafael J. Wysocki

    Rafael J. Wysocki
     

18 May, 2011

1 commit

  • Martin reports that on his system hibernation occasionally fails due
    to the lack of memory, because the radeon driver apparently allocates
    too much of it during the device freeze stage. It turns out that the
    amount of memory allocated by radeon during hibernation (and
    presumably during system suspend too) depends on the utilization of
    the GPU (e.g. hibernating while there are two KDE 4 sessions with
    compositing enabled causes radeon to allocate more memory than for
    one KDE 4 session).

    In principle it should be possible to use image_size to make the
    memory preallocation mechanism free enough memory for the radeon
    driver, but in practice it is not easy to guess the right value
    because of the way the preallocation code uses image_size. For this
    reason, it seems reasonable to allow users to control the amount of
    memory reserved for driver allocations made after the hibernate
    preallocation, which currently is constant and amounts to 1 MB.

    Introduce a new sysfs file, /sys/power/reserved_size, whose value
    will be used as the amount of memory to reserve for the
    post-preallocation reservations made by device drivers, in bytes.
    For backwards compatibility, set its default (and initial) value to
    the currently used number (1 MB).

    References: https://bugzilla.kernel.org/show_bug.cgi?id=34102
    Reported-and-tested-by: Martin Steigerwald
    Signed-off-by: Rafael J. Wysocki

    Rafael J. Wysocki
     

17 Oct, 2010

2 commits

  • The default hibernation image size is currently hard coded and euqal
    to 500 MB, which is not a reasonable default on many contemporary
    systems. Make it equal 2/5 of the total RAM size (this is slightly
    below the maximum, i.e. 1/2 of the total RAM size, and seems to be
    generally suitable).

    Signed-off-by: Rafael J. Wysocki
    Tested-by: M. Vefa Bicakci

    Rafael J. Wysocki
     
  • Compress hibernation image with LZO in order to save on I/O and
    therefore time to hibernate/thaw.

    [rjw: Added hibernate=nocompress command line option instead of just
    nocompress which would be confusing, fixed a couple of compiler
    warnings, fixed kerneldoc comments, minor cleanups.]

    Signed-off-by: Bojan Smojver
    Signed-off-by: Rafael J. Wysocki

    Bojan Smojver
     

11 May, 2010

2 commits

  • Move block I/O operations to a separate file. It is because it will
    be used later not only by the swap writer.

    Signed-off-by: Jiri Slaby
    Signed-off-by: Rafael J. Wysocki

    Jiri Slaby
     
  • Remove support of reads with offset. This means snapshot_read/write_next
    now does not accept count parameter. It allows to clean up the functions
    and snapshot handle which no longer needs to care about offsets.

    /dev/snapshot handler is converted to simple_{read_from,write_to}_buffer
    which take care of offsets.

    Signed-off-by: Jiri Slaby
    Acked-by: Pavel Machek
    Signed-off-by: Rafael J. Wysocki

    Jiri Slaby
     

15 Sep, 2009

1 commit

  • Since the hibernation code is now going to use allocations of memory
    to make enough room for the image, it can also use the page frames
    allocated at this stage as image page frames. The low-level
    hibernation code needs to be rearranged for this purpose, but it
    allows us to avoid freeing a great number of pages and allocating
    these same pages once again later, so it generally is worth doing.

    [rev. 2: Take highmem into account correctly.]

    Signed-off-by: Rafael J. Wysocki

    Rafael J. Wysocki
     

13 Jun, 2009

3 commits

  • Change the name of kernel/power/disk.c to kernel/power/hibernate.c
    in analogy with the file names introduced by the changes that
    separated the suspend to RAM and standby funtionality from the
    common PM functions.

    Signed-off-by: Rafael J. Wysocki
    Acked-by: Pavel Machek

    Rafael J. Wysocki
     
  • Move the suspend to RAM and standby code from kernel/power/main.c
    to two separate files, kernel/power/suspend.c containing the basic
    functions and kernel/power/suspend_test.c containing the automatic
    suspend test facility based on the RTC clock alarm.

    There are no changes in functionality related to these modifications.

    Signed-off-by: Rafael J. Wysocki
    Acked-by: Pavel Machek

    Rafael J. Wysocki
     
  • A future patch is going to modify the memory shrinking code so that
    it will make memory allocations to free memory instead of using an
    artificial memory shrinking mechanism for that. For this purpose it
    is convenient to move swsusp_shrink_memory() from
    kernel/power/swsusp.c to kernel/power/snapshot.c, because the new
    memory-shrinking code is going to use things that are local to
    kernel/power/snapshot.c .

    [rev. 2: Make some functions static and remove their headers from
    kernel/power/power.h]

    Signed-off-by: Rafael J. Wysocki
    Acked-by: Pavel Machek
    Acked-by: Wu Fengguang

    Rafael J. Wysocki
     

21 Oct, 2008

1 commit


27 Jul, 2008

1 commit

  • This patch implements devices state save/restore before after kexec.

    This patch together with features in kexec_jump patch can be used for
    following:

    - A simple hibernation implementation without ACPI support. You can kexec a
    hibernating kernel, save the memory image of original system and shutdown
    the system. When resuming, you restore the memory image of original system
    via ordinary kexec load then jump back.

    - Kernel/system debug through making system snapshot. You can make system
    snapshot, jump back, do some thing and make another system snapshot.

    - Cooperative multi-kernel/system. With kexec jump, you can switch between
    several kernels/systems quickly without boot process except the first time.
    This appears like swap a whole kernel/system out/in.

    - A general method to call program in physical mode (paging turning
    off). This can be used to invoke BIOS code under Linux.

    The following user-space tools can be used with kexec jump:

    - kexec-tools needs to be patched to support kexec jump. The patches
    and the precompiled kexec can be download from the following URL:
    source: http://khibernation.sourceforge.net/download/release_v10/kexec-tools/kexec-tools-src_git_kh10.tar.bz2
    patches: http://khibernation.sourceforge.net/download/release_v10/kexec-tools/kexec-tools-patches_git_kh10.tar.bz2
    binary: http://khibernation.sourceforge.net/download/release_v10/kexec-tools/kexec_git_kh10

    - makedumpfile with patches are used as memory image saving tool, it
    can exclude free pages from original kernel memory image file. The
    patches and the precompiled makedumpfile can be download from the
    following URL:
    source: http://khibernation.sourceforge.net/download/release_v10/makedumpfile/makedumpfile-src_cvs_kh10.tar.bz2
    patches: http://khibernation.sourceforge.net/download/release_v10/makedumpfile/makedumpfile-patches_cvs_kh10.tar.bz2
    binary: http://khibernation.sourceforge.net/download/release_v10/makedumpfile/makedumpfile_cvs_kh10

    - An initramfs image can be used as the root file system of kexeced
    kernel. An initramfs image built with "BuildRoot" can be downloaded
    from the following URL:
    initramfs image: http://khibernation.sourceforge.net/download/release_v10/initramfs/rootfs_cvs_kh10.gz
    All user space tools above are included in the initramfs image.

    Usage example of simple hibernation:

    1. Compile and install patched kernel with following options selected:

    CONFIG_X86_32=y
    CONFIG_RELOCATABLE=y
    CONFIG_KEXEC=y
    CONFIG_CRASH_DUMP=y
    CONFIG_PM=y
    CONFIG_HIBERNATION=y
    CONFIG_KEXEC_JUMP=y

    2. Build an initramfs image contains kexec-tool and makedumpfile, or
    download the pre-built initramfs image, called rootfs.gz in
    following text.

    3. Prepare a partition to save memory image of original kernel, called
    hibernating partition in following text.

    4. Boot kernel compiled in step 1 (kernel A).

    5. In the kernel A, load kernel compiled in step 1 (kernel B) with
    /sbin/kexec. The shell command line can be as follow:

    /sbin/kexec --load-preserve-context /boot/bzImage --mem-min=0x100000
    --mem-max=0xffffff --initrd=rootfs.gz

    6. Boot the kernel B with following shell command line:

    /sbin/kexec -e

    7. The kernel B will boot as normal kexec. In kernel B the memory
    image of kernel A can be saved into hibernating partition as
    follow:

    jump_back_entry=`cat /proc/cmdline | tr ' ' '\n' | grep kexec_jump_back_entry | cut -d '='`
    echo $jump_back_entry > kexec_jump_back_entry
    cp /proc/vmcore dump.elf

    Then you can shutdown the machine as normal.

    8. Boot kernel compiled in step 1 (kernel C). Use the rootfs.gz as
    root file system.

    9. In kernel C, load the memory image of kernel A as follow:

    /sbin/kexec -l --args-none --entry=`cat kexec_jump_back_entry` dump.elf

    10. Jump back to the kernel A as follow:

    /sbin/kexec -e

    Then, kernel A is resumed.

    Implementation point:

    To support jumping between two kernels, before jumping to (executing)
    the new kernel and jumping back to the original kernel, the devices
    are put into quiescent state, and the state of devices and CPU is
    saved. After jumping back from kexeced kernel and jumping to the new
    kernel, the state of devices and CPU are restored accordingly. The
    devices/CPU state save/restore code of software suspend is called to
    implement corresponding function.

    Known issues:

    - Because the segment number supported by sys_kexec_load is limited,
    hibernation image with many segments may not be load. This is
    planned to be eliminated by adding a new flag to sys_kexec_load to
    make a image can be loaded with multiple sys_kexec_load invoking.

    Now, only the i386 architecture is supported.

    Signed-off-by: Huang Ying
    Acked-by: Vivek Goyal
    Cc: "Eric W. Biederman"
    Cc: Pavel Machek
    Cc: Nigel Cunningham
    Cc: "Rafael J. Wysocki"
    Cc: Ingo Molnar
    Cc: Thomas Gleixner
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Huang Ying
     

02 Feb, 2008

11 commits

  • This patch makes the freezer optional for suspend to allow the
    system to work (or not work) like the original PMU suspend.

    Signed-off-by: Johannes Berg
    Acked-by: Pavel Machek
    Signed-off-by: Rafael J. Wysocki
    Signed-off-by: Len Brown

    Johannes Berg
     
  • Move the low level restore code to kernel/power/disk.c , since the
    corresponding low level hibernation code is already there.

    Make restore fail if device_power_down(PMSG_PRETHAW) returns an
    error.

    Signed-off-by: Rafael J. Wysocki
    Acked-by: Pavel Machek
    Signed-off-by: Len Brown

    Rafael J. Wysocki
     
  • This patch (as1008b) converts the PM notifier routines from inline
    calls to out-of-line code. It also prevents pm_chain_head from
    being created when CONFIG_PM_SLEEP isn't enabled, and EXPORTs the
    notifier registration and unregistration routines.

    Signed-off-by: Alan Stern
    Signed-off-by: Rafael J. Wysocki
    Signed-off-by: Len Brown

    Alan Stern
     
  • Make it possible to test the hibernation core code with the help of the
    /sys/power/pm_test attribute introduced for suspend testing in the previous
    patch.

    Writing an appropriate string to this file causes the hibernation code to work
    in one of the test modes defined as follows:

    freezer
    - test the freezing of processes

    devices
    - test the freezing of processes and suspending of devices

    platform
    - test the freezing of processes, suspending of devices and platform global
      control methods(*)

    processors
    - test the freezing of processes, suspending of devices, platform global
      control methods(*) and the disabling of nonboot CPUs

    core
    - test the freezing of processes, suspending of devices, platform global
      control methods(*), the disabling of nonboot CPUs and suspending of
      platform/system devices

    (*) - the platform global control methods are only available on ACPI systems
          and are only tested if the hibernation mode is set to "platform"

    Then, if a hibernation is started by normal means, the hibernation core will
    perform its normal operations up to the point indicated by given test level.
    Next, it will wait for 5 seconds and carry out the resume operations needed to
    transition the system back to the fully functional state.

    Signed-off-by: Rafael J. Wysocki
    Acked-by: Pavel Machek
    Signed-off-by: Len Brown

    Rafael J. Wysocki
     
  • Introduce sysfs attribute /sys/power/pm_test allowing one to test the suspend
    core code.  Namely, writing one of the strings:

    freezer
    devices
    platform
    processors
    core

    to this file causes the suspend code to work in one of the test modes defined as
    follows:

    freezer
    - test the freezing of processes

    devices
    - test the freezing of processes and suspending of devices

    platform
    - test the freezing of processes, suspending of devices and platform global
      control methods(*)

    processors
    - test the freezing of processes, suspending of devices, platform global
      control methods and the disabling of nonboot CPUs

    core
    - test the freezing of processes, suspending of devices, platform global
      control methods, the disabling of nonboot CPUs and suspending of
      platform/system devices

    (*) These are ACPI global control methods on ACPI systems

    Then, if a suspend is started by normal means, the suspend core will perform
    its normal operations up to the point indicated by given test level.  Next, it
    will wait for 5 seconds and carry out the resume operations needed to transition
    the system back to the fully functional state.

    Writing "none" to /sys/power/pm_test turns the testing off.

    When open for reading, /sys/power/pm_test contains a space-separated list of all
    available tests (including "none" that represents the normal functionality) in
    which the current test level is indicated by square brackets.

    Signed-off-by: Rafael J. Wysocki
    Acked-by: Pavel Machek
    Signed-off-by: Len Brown

    Rafael J. Wysocki
     
  • This patch moves the prototypes of count_highmem_pages() and
    restore_highmem() to kernel/power/power.h

    Signed-off-by: Adrian Bunk
    Acked-by: Pavel Machek
    Signed-off-by: Rafael J. Wysocki
    Signed-off-by: Len Brown

    Adrian Bunk
     
  • Move the definitions of hibernation ioctls to a separate header file in
    include/linux, which can be exported to the user space.

    Signed-off-by: Rafael J. Wysocki
    Acked-by: Pavel Machek
    Signed-off-by: Len Brown

    Rafael J. Wysocki
     
  • Three ioctl numbers belonging to the hibernation userland interface,
    SNAPSHOT_ATOMIC_SNAPSHOT, SNAPSHOT_AVAIL_SWAP, SNAPSHOT_GET_SWAP_PAGE,
    are defined in a wrong way (eg. not portable). Provide new ioctl numbers for
    these ioctls and mark the existing ones as deprecated.

    Signed-off-by: Rafael J. Wysocki
    Acked-by: Pavel Machek
    Signed-off-by: Len Brown

    Rafael J. Wysocki
     
  • Mark the SNAPSHOT_SET_SWAP_FILE ioctl belonging to the hibernation userland
    interface as deprecated.

    Signed-off-by: Rafael J. Wysocki
    Acked-by: Pavel Machek
    Signed-off-by: Len Brown

    Rafael J. Wysocki
     
  • Modify the hibernation userland interface by adding two new ioctls to it,
    SNAPSHOT_PLATFORM_SUPPORT and SNAPSHOT_POWER_OFF, that can be used,
    respectively, to switch the hibernation platform support on/off and to make the
    kernel transition the system to the hibernation state (eg. ACPI S4) using the
    platform (eg. ACPI) driver.

    These ioctls are intended to replace the misdesigned SNAPSHOT_PMOPS ioctl,
    which from now is regarded as obsolete and will be removed in the future.

    Signed-off-by: Rafael J. Wysocki
    Acked-by: Pavel Machek
    Signed-off-by: Len Brown

    Rafael J. Wysocki
     
  • Add a new ioctl, SNAPSHOT_GET_IMAGE_SIZE, returning the size of the (just
    created) hibernation image, to the hibernation userland interface.

    This ioctl is necessary so that the userland utilities using the interface need
    not access the hibernation image header, owned by the kernel, in order to obtain
    the size of the image.

    Signed-off-by: Rafael J. Wysocki
    Acked-by: Pavel Machek
    Signed-off-by: Len Brown

    Rafael J. Wysocki
     

25 Jan, 2008

2 commits

  • Switch all dynamically created ksets, that export simple attributes,
    to kobj_attribute from subsys_attribute. Struct subsys_attribute will
    be removed.

    Signed-off-by: Kay Sievers
    Cc: Mike Halcrow
    Cc: Phillip Hellewell
    Signed-off-by: Greg Kroah-Hartman

    Kay Sievers
     
  • Dynamically create the kset instead of declaring it statically. We also
    rename power_subsys to power_kset to catch all users of the variable and
    we properly export it so that people don't have to guess that it really
    is present in the system.

    The pseries code is wierd, why is it createing /sys/power if CONFIG_PM
    is disabled? Oh well, stupid big boxes ignoring config options...

    Cc: Kay Sievers
    Signed-off-by: Greg Kroah-Hartman

    Greg Kroah-Hartman
     

19 Oct, 2007

2 commits

  • The following scenario leads to total confusion of the platform firmware on
    some boxes (eg. HPC nx6325):
    * Hibernate with ACPI enabled
    * Resume passing "acpi=off" to the boot kernel

    To prevent this from happening it's necessary to check if ACPI is enabled (and
    enable it if that's not the case) _right_ _after_ control has been transfered
    from the boot kernel to the image kernel, before device_power_up() is called
    (ie. with interrupts disabled).  Enabling ACPI after calling
    device_power_up() turns out to be insufficient.

    For this reason, introduce new hibernation callback ->leave() that will be
    executed before device_power_up() by the restored image kernel.  To make it
    work, it also is necessary to move swsusp_suspend() from swsusp.c to disk.c
    (it's name is changed to "create_image", which is more up to the point).

    Signed-off-by: Rafael J. Wysocki
    Acked-by: Pavel Machek
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Rafael J. Wysocki
     
  • Add the bits needed for supporting arbitrary boot kernels to the common
    hibernation code.

    To support arbitrary boot kernels, make it possible to replace the 'struct
    new_utsname' and the kernel version in the hibernation image header by some
    architecture specific data that will be used to verify if the image is valid
    and to restore the image.

    Signed-off-by: Rafael J. Wysocki
    Acked-by: Pavel Machek
    Cc: Andi Kleen
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Rafael J. Wysocki
     

30 Jul, 2007

2 commits

  • Introduce CONFIG_SUSPEND representing the ability to enter system sleep
    states, such as the ACPI S3 state, and allow the user to choose SUSPEND
    and HIBERNATION independently of each other.

    Make HOTPLUG_CPU be selected automatically if SUSPEND or HIBERNATION has
    been chosen and the kernel is intended for SMP systems.

    Also, introduce CONFIG_PM_SLEEP which is automatically selected if
    CONFIG_SUSPEND or CONFIG_HIBERNATION is set and use it to select the
    code needed for both suspend and hibernation.

    The top-level power management headers and the ACPI code related to
    suspend and hibernation are modified to use the new definitions (the
    changes in drivers/acpi/sleep/main.c are, mostly, moving code to reduce
    the number of ifdefs).

    There are many other files in which CONFIG_PM can be replaced with
    CONFIG_PM_SLEEP or even with CONFIG_SUSPEND, but they can be updated in
    the future.

    Signed-off-by: Rafael J. Wysocki
    Signed-off-by: Linus Torvalds

    Rafael J. Wysocki
     
  • Replace CONFIG_SOFTWARE_SUSPEND with CONFIG_HIBERNATION to avoid
    confusion (among other things, with CONFIG_SUSPEND introduced in the
    next patch).

    Signed-off-by: Rafael J. Wysocki
    Signed-off-by: Linus Torvalds

    Rafael J. Wysocki
     

20 Jul, 2007

4 commits

  • The SNAPSHOT_S2RAM ioctl code is outdated and it should not duplicate the
    suspend code in kernel/power/main.c. Fix that.

    Signed-off-by: Rafael J. Wysocki
    Acked-by: Pavel Machek
    Cc: Nigel Cunningham
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Rafael J. Wysocki
     
  • Make it possible to register hibernation and suspend notifiers, so that
    subsystems can perform hibernation-related or suspend-related operations that
    should not be carried out by device drivers' .suspend() and .resume()
    routines.

    [akpm@linux-foundation.org: build fixes]
    [akpm@linux-foundation.org: cleanups]
    Signed-off-by: Rafael J. Wysocki
    Acked-by: Pavel Machek
    Cc: Nigel Cunningham
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Rafael J. Wysocki
     
  • At least on some machines it is necessary to prepare the ACPI firmware for the
    restoration of the system memory state from the hibernation image if the
    "platform" mode of hibernation has been used. Namely, in that cases we need
    to disable the GPEs before replacing the "boot" kernel with the "frozen"
    kernel (cf. http://bugzilla.kernel.org/show_bug.cgi?id=7887). After the
    restore they will be re-enabled by hibernation_ops->finish(), but if the
    restore fails, they have to be re-enabled by the restore code explicitly.

    For this purpose we can introduce two additional hibernation operations,
    called pre_restore() and restore_cleanup() and call them from the restore code
    path. Still, they should be called if the "platform" mode of hibernation has
    been used, so we need to pass the information about the hibernation mode from
    the "frozen" kernel to the "boot" kernel in the image header.

    Apparently, we can't drop the disabling of GPEs before the restore because of
    Bug #7887 .  We also can't do it unconditionally, because the GPEs wouldn't
    have been enabled after a successful restore if the suspend had been done in
    the 'shutdown' or 'reboot' mode.

    In principle we could (and probably should) unconditionally disable the GPEs
    before each snapshot creation *and* before the restore, but then we'd have to
    unconditionally enable them after the snapshot creation as well as after the
    restore (or restore failure)   Still, for this purpose we'd need to modify
    acpi_enter_sleep_state_prep() and acpi_leave_sleep_state() and we'd have to
    introduce some mechanism synchronizing the disablind/enabling of the GPEs with
    the device drivers' .suspend()/.resume() routines and with
    disable_/enable_nonboot_cpus().  However, this would have affected the
    suspend (ie. s2ram) code as well as the hibernation, which I'd like to avoid
    in this patch series.

    Signed-off-by: Rafael J. Wysocki
    Cc: Nigel Cunningham
    Cc: Pavel Machek
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Rafael J. Wysocki
     
  • Currently, much of the code in kernel/power/disk.c is duplicated in
    kernel/power/user.c , mainly for historical reasons. By eliminating this code
    duplication we can reduce the size of user.c quite substantially and remove
    the maintenance difficulty resulting from it.

    [bunk@stusta.de: kernel/power/disk.c: make code static]
    Signed-off-by: Rafael J. Wysocki
    Acked-by: Pavel Machek
    Cc: Nigel Cunningham
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Rafael J. Wysocki
     

10 May, 2007

1 commit

  • [ With Johannes Berg ]

    Separate the hibernation (aka suspend to disk code) from the other suspend
    code. In particular:

    * Remove the definitions related to hibernation from include/linux/pm.h
    * Introduce struct hibernation_ops and a new hibernate() function to hibernate
    the system, defined in include/linux/suspend.h
    * Separate suspend code in kernel/power/main.c from hibernation-related code
    in kernel/power/disk.c and kernel/power/user.c (with the help of
    hibernation_ops)
    * Switch ACPI (the only user of pm_ops.pm_disk_mode) to hibernation_ops

    Signed-off-by: Rafael J. Wysocki
    Cc: Greg KH
    Cc: Pavel Machek
    Cc: Nigel Cunningham
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Rafael J. Wysocki
     

08 May, 2007

4 commits

  • Move the definition of PAGES_FOR_IO to kernel/power/power.h and introduce
    SPARE_PAGES representing the number of pages that should be freed by the
    swsusp's memory shrinker in addition to PAGES_FOR_IO so that device drivers
    can allocate some memory (up to 1 MB total) in their .suspend() routines
    without causing the suspend to fail.

    Signed-off-by: Rafael J. Wysocki
    Acked-by: Pavel Machek
    Cc: Nigel Cunningham
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Rafael J. Wysocki
     
  • Make swsusp use extents instead of a bitmap to trace swap pages allocated
    for saving the image (the tracking is only needed in case there's an error,
    so that the allocated swap pages can be released).

    This should allow us to reduce the memory usage, practically always, and
    improve performance.

    Signed-off-by: Rafael J. Wysocki
    Cc: Nigel Cunningham
    Cc: Pavel Machek
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Rafael J. Wysocki
     
  • 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
    Acked-by: Pavel Machek
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Rafael J. Wysocki
     
  • Make swsusp use memory bitmaps instead of page flags for marking 'nosave' and
    free pages. This allows us to 'recycle' two page flags that can be used for
    other purposes. Also, the memory needed to store the bitmaps is allocated
    when necessary (ie. before the suspend) and freed after the resume which is
    more reasonable.

    The patch is designed to minimize the amount of changes and there are some
    nice simplifications and optimizations possible on top of it. I am going to
    implement them separately in the future.

    Signed-off-by: Rafael J. Wysocki
    Acked-by: Pavel Machek
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Rafael J. Wysocki