03 May, 2007

1 commit

  • o __pa() should be used only on kernel linearly mapped virtual addresses
    and not on kernel text and data addresses.

    o Hibernation code needs to determine the physical address associated
    with kernel symbol to mark a section boundary which contains pages which
    don't have to be saved and restored during hibernate/resume operation.

    o Move this piece of code in arch dependent section. So that architectures
    which don't have kernel text/data mapped into kernel linearly mapped
    region can come up with their own ways of determining physical addresses
    associated with a kernel text.

    Signed-off-by: Vivek Goyal
    Signed-off-by: Andi Kleen

    Vivek Goyal
     

12 Feb, 2007

1 commit

  • This is again simplifies some of the VM counter calculations through the use
    of the ZVC consolidated counters.

    [michal.k.k.piotrowski@gmail.com: build fix]
    Signed-off-by: Christoph Lameter
    Signed-off-by: Michal Piotrowski
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Christoph Lameter
     

08 Dec, 2006

3 commits

  • Move all labels in the swsusp code to the second column, so that they won't
    fool diff -p.

    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
     
  • Fix coding style in suspend.c.

    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
     
  • Currently swsusp saves the contents of highmem pages by copying them to the
    normal zone which is quite inefficient (eg. it requires two normal pages
    to be used for saving one highmem page). This may be improved by using
    highmem for saving the contents of saveable highmem pages.

    Namely, during the suspend phase of the suspend-resume cycle we try to
    allocate as many free highmem pages as there are saveable highmem pages.
    If there are not enough highmem image pages to store the contents of all of
    the saveable highmem pages, some of them will be stored in the "normal"
    memory. Next, we allocate as many free "normal" pages as needed to store
    the (remaining) image data. We use a memory bitmap to mark the allocated
    free pages (ie. highmem as well as "normal" image pages).

    Now, we use another memory bitmap to mark all of the saveable pages
    (highmem as well as "normal") and the contents of the saveable pages are
    copied into the image pages. Then, the second bitmap is used to save the
    pfns corresponding to the saveable pages and the first one is used to save
    their data.

    During the resume phase the pfns of the pages that were saveable during the
    suspend are loaded from the image and used to mark the "unsafe" page
    frames. Next, we try to allocate as many free highmem page frames as to
    load all of the image data that had been in the highmem before the suspend
    and we allocate so many free "normal" page frames that the total number of
    allocated free pages (highmem and "normal") is equal to the size of the
    image. While doing this we have to make sure that there will be some extra
    free "normal" and "safe" page frames for two lists of PBEs constructed
    later.

    Now, the image data are loaded, if possible, into their "original" page
    frames. The image data that cannot be written into their "original" page
    frames are loaded into "safe" page frames and their "original" kernel
    virtual addresses, as well as the addresses of the "safe" pages containing
    their copies, are stored in one of two lists of PBEs.

    One list of PBEs is for the copies of "normal" suspend pages (ie. "normal"
    pages that were saveable during the suspend) and it is used in the same way
    as previously (ie. by the architecture-dependent parts of swsusp). The
    other list of PBEs is for the copies of highmem suspend pages. The pages
    in this list are restored (in a reversible way) right before the
    arch-dependent code is called.

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

    Rafael J. Wysocki
     

02 Oct, 2006

1 commit

  • In some places, particularly drivers and __init code, the init utsns is the
    appropriate one to use. This patch replaces those with a the init_utsname
    helper.

    Changes: Removed several uses of init_utsname(). Hope I picked all the
    right ones in net/ipv4/ipconfig.c. These are now changed to
    utsname() (the per-process namespace utsname) in the previous
    patch (2/7)

    [akpm@osdl.org: CIFS fix]
    Signed-off-by: Serge E. Hallyn
    Cc: Kirill Korotaev
    Cc: "Eric W. Biederman"
    Cc: Herbert Poetzl
    Cc: Andrey Savochkin
    Cc: Serge Hallyn
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Serge E. Hallyn
     

26 Sep, 2006

10 commits

  • Make swsusp use memory bitmaps to store its internal information during the
    resume phase of the suspend-resume cycle.

    If the pfns of saveable pages are saved during the suspend phase instead of
    the kernel virtual addresses of these pages, we can use them during the resume
    phase directly to set the corresponding bits in a memory bitmap. Then, this
    bitmap is used to mark the page frames corresponding to the pages that were
    saveable before the suspend (aka "unsafe" page frames).

    Next, we allocate as many page frames as needed to store the entire suspend
    image and make sure that there will be some extra free "safe" page frames for
    the list of PBEs constructed later. Subsequently, the image is loaded and, if
    possible, the data loaded from it are written into their "original" page
    frames (ie. the ones they had occupied before the suspend).

    The image data that cannot be written into their "original" page frames are
    loaded into "safe" page frames and their "original" kernel virtual addresses,
    as well as the addresses of the "safe" pages containing their copies, are
    stored in a list of PBEs. Finally, the list of PBEs is used to copy the
    remaining image data into their "original" page frames (this is done
    atomically, by the architecture-dependent parts of swsusp).

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

    Rafael J. Wysocki
     
  • Introduce the memory bitmap data structure and make swsusp use in the suspend
    phase.

    The current swsusp's internal data structure is not very efficient from the
    memory usage point of view, so it seems reasonable to replace it with a data
    structure that will require less memory, such as a pair of bitmaps.

    The idea is to use bitmaps that may be allocated as sets of individual pages,
    so that we can avoid making allocations of order greater than 0. For this
    reason the memory bitmap structure consists of several linked lists of objects
    that contain pointers to memory pages with the actual bitmap data. Still, for
    a typical system all of these lists fit in a single page, so it's reasonable
    to introduce an additional mechanism allowing us to allocate all of them
    efficiently without sacrificing the generality of the design. This is done
    with the help of the chain_allocator structure and associated functions.

    We need to use two memory bitmaps during the suspend phase of the
    suspend-resume cycle. One of them is necessary for marking the saveable
    pages, and the second is used to mark the pages in which to store the copies
    of them (aka image pages).

    First, the bitmaps are created and we allocate as many image pages as needed
    (the corresponding bits in the second bitmap are set as soon as the pages are
    allocated). Second, the bits corresponding to the saveable pages are set in
    the first bitmap and the saveable pages are copied to the image pages.
    Finally, the first bitmap is used to save the kernel virtual addresses of the
    saveable pages and the second one is used to save the contents of the image
    pages.

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

    Rafael J. Wysocki
     
  • Introduce some constants that hopefully will help improve the readability of
    code in kernel/power/snapshot.c.

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

    Rafael J. Wysocki
     
  • The name of the pagedir_nosave variable does not make sense any more, so it
    seems reasonable to change it to something more meaningful.

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

    Rafael J. Wysocki
     
  • Get rid of the FIXME in kernel/power/snapshot.c#alloc_pagedir() and
    simplify the functions called by it.

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

    Rafael J. Wysocki
     
  • Move some functions in kernel/power/snapshot.c to a better place (in the
    same file) and introduce free_image_page() (will be necessary 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
     
  • Clean up mm/page_alloc.c#mark_free_pages() and make it avoid clearing
    PageNosaveFree for PageNosave pages. This allows us to get rid of an ugly
    hack in kernel/power/snapshot.c#copy_data_pages().

    Additionally, the page-copying loop in copy_data_pages() is moved to an
    inline function.

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

    Rafael J. Wysocki
     
  • Add comments describing struct snapshot_handle and its members, change the
    confusing name of its member 'page' to 'cur'.

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

    Rafael J. Wysocki
     
  • Clean up some loops over pfns for each zone in snapshot.c: reduce the
    number of additions to perform, rework detection of saveable pages and make
    the code a bit less difficult to understand, hopefully.

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

    Rafael J. Wysocki
     
  • Implement async reads for swsusp resuming.

    Crufty old PIII testbox:
    15.7 MB/s -> 20.3 MB/s

    Sony Vaio:
    14.6 MB/s -> 33.3 MB/s

    I didn't implement the post-resume bio_set_pages_dirty(). I don't really
    understand why resume needs to run set_page_dirty() against these pages.

    It might be a worry that this code modifies PG_Uptodate, PG_Error and
    PG_Locked against the image pages. Can this possibly affect the resumed-into
    kernel? Hopefully not, if we're atomically restoring its mem_map?

    Cc: Pavel Machek
    Cc: "Rafael J. Wysocki"
    Cc: Jens Axboe
    Cc: Laurent Riffard
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Andrew Morton
     

11 Jul, 2006

1 commit

  • swsusp should not use memcpy for snapshotting memory, because on some
    architectures memcpy may increase preempt_count (i386 does this when
    CONFIG_X86_USE_3DNOW is set). Then, as a result, wrong value of preempt_count
    is stored in the image.

    Replace memcpy in copy_data_pages with an open-coded loop.

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

    Rafael J. Wysocki
     

26 Jun, 2006

1 commit

  • This reverts commits

    3e3318dee0878d42ed62a19c292a2ac284135db3 [PATCH] swsusp: x86_64 mark special saveable/unsaveable pages
    b6370d96e09944c6e3ae8d5743ca8a8ab1f79f6c [PATCH] swsusp: i386 mark special saveable/unsaveable pages
    ce4ab0012b32c1a4a1d6e934aeb73bf3151c48d9 [PATCH] swsusp: add architecture special saveable pages support

    because not only do they apparently cause page faults on x86, the
    infrastructure doesn't compile on powerpc.

    Signed-off-by: Linus Torvalds

    Linus Torvalds
     

23 Jun, 2006

3 commits

  • Make swsusp allocate only as much memory as needed to store the image data
    and metadata during resume.

    Without this patch swsusp additionally allocates many page frames that will
    conflict with the "original" locations of the image data and are considered
    as "unsafe", treating them as "eaten" pages (ie. allocated but unusable).

    The patch makes swsusp allocate as many pages as it'll need to store the
    data read from the image in one shot, creating a list of allocated "safe"
    pages, and use the observation that all pages allocated by it are marked
    with the PG_nosave and PG_nosave_free flags set.  Namely, when it's about
    to load an image page, swsusp can check whether the page frame
    corresponding to the "original" location of this page has been allocated
    (ie. if the page frame has the PG_nosave and PG_nosave_free flags set) and
    if so, it can load the page directly into this page frame.  Otherwise it
    uses an allocated "safe" page from the list to store the data that will be
    copied to their "original" location later on.

    This allows us to save many page copyings and page allocations during
    resume and in the future it may allow us to load images greater than 50% of
    the normal zone.

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

    Rafael J. Wysocki
     
  • - make needlessly global functions static
    - make dummy functions static inline

    Signed-off-by: Adrian Bunk
    Acked-by: Pavel Machek
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Adrian Bunk
     
  • 1. Add architecture specific pages save/restore support. Next two patches
    will use this to save/restore 'ACPI NVS' pages.

    2. Allow reserved pages 'nosave'. This could avoid save/restore BIOS
    reserved pages.

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

    Shaohua Li
     

20 Apr, 2006

1 commit

  • The function free_pagedir() used by swsusp for freeing its internal data
    structures clears the PG_nosave and PG_nosave_free flags for each page
    being freed.

    However, during resume PG_nosave_free set means that the page in
    question is "unsafe" (ie. it will be overwritten in the process of
    restoring the saved system state from the image), so it should not be
    used for the image data.

    Therefore free_pagedir() should not clear PG_nosave_free if it's called
    during resume (otherwise "unsafe" pages freed by it may be used for
    storing the image data and the data may get corrupted later on).

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

    Rafael J. Wysocki
     

23 Mar, 2006

4 commits

  • Highmem could be in pcp list as well.

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

    Shaohua Li
     
  • Combination of printk/pr_debug led to in the middle of the line, and we
    printed way too many dots.

    Signed-off-by: Pavel Machek
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Pavel Machek
     
  • This patch introduces a user space interface for swsusp.

    The interface is based on a special character device, called the snapshot
    device, that allows user space processes to perform suspend and resume-related
    operations with the help of some ioctls and the read()/write() functions.
     Additionally it allows these processes to allocate free swap pages from a
    selected swap partition, called the resume partition, so that they know which
    sectors of the resume partition are available to them.

    The interface uses the same low-level system memory snapshot-handling
    functions that are used by the built-it swap-writing/reading code of swsusp.

    The interface documentation is included in the patch.

    The patch assumes that the major and minor numbers of the snapshot device will
    be 10 (ie. misc device) and 231, the registration of which has already been
    requested.

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

    Rafael J. Wysocki
     
  • Introduce the low level interface that can be used for handling the
    snapshot of the system memory by the in-kernel swap-writing/reading code of
    swsusp and the userland interface code (to be introduced shortly).

    Also change the way in which swsusp records the allocated swap pages and,
    consequently, simplifies the in-kernel swap-writing/reading code (this is
    necessary for the userland interface too). To this end, it introduces two
    helper functions in mm/swapfile.c, so that the swsusp code does not refer
    directly to the swap internals.

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

    Rafael J. Wysocki
     

16 Feb, 2006

1 commit


07 Jan, 2006

3 commits

  • This patch fixes a problem with the function enough_free_mem() used by
    swsusp to verify if there is a sufficient number of memory pages available
    to it to create and save the suspend image.

    Namely, enough_free_mem() uses nr_free_pages() to obtain the number of free
    memory pages, which is incorrect, because this function returns the total
    number of free pages, including free highmem pages, and the highmem pages
    cannot be used by swsusp for storing the image data.

    The patch makes enough_free_mem() avoid counting the free highmem
    pages as available to swsusp.

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

    Rafael J. Wysocki
     
  • This patch makes swsusp free only as much memory as needed to complete the
    suspend and not as much as possible.  In the most of cases this should speed
    up the suspend and make the system much more responsive after resume,
    especially if a GUI (eg. X Windows) is used.

    If needed, the old behavior (ie to free as much memory as possible during
    suspend) can be restored by unsetting FAST_FREE in power.h

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

    Rafael J. Wysocki
     
  • This patch introduces the swap map structure that can be used by swsusp for
    keeping tracks of data pages written to the swap.  The structure itself is
    described in a comment within the patch.

    The overall idea is to reduce the amount of metadata written to the swap and
    to write and read the image pages sequentially, in a file-alike way. This
    makes the swap-handling part of swsusp fairly independent of its
    snapshot-handling part and will hopefully allow us to completely separate
    these two parts in the future.

    This patch is needed to remove the suspend image size limit imposed by the
    limited size of the swsusp_info structure, which is essential for x86-64
    systems with more than 512 MB of RAM.

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

    Rafael J. Wysocki
     

09 Nov, 2005

3 commits

  • This patch makes only the functions in swsusp.c call functions in snapshot.c
    and not both ways.  It also moves the check for available swap out of
    swsusp_suspend() which is necessary for separating the swap-handling functions
    in swsusp from the core code.

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

    Rafael J. Wysocki
     
  • This patch simplifies the relocation of the page backup list (aka pagedir)
    during resume.

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

    Rafael J. Wysocki
     
  • The changes made by this patch are necessary for the pagedir relocation
    simplification in the next patch.  Additionally, these changes allow us to
    drop check_pagedir() and make get_safe_page() be a one-line wrapper around
    alloc_image_page() (get_safe_page() goes to snapshot.c, because
    alloc_image_page() is static and it does not make sense to export it).

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

    Rafael J. Wysocki
     

07 Nov, 2005

1 commit


31 Oct, 2005

6 commits