26 Sep, 2006

5 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
     
  • 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
     
  • 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
     
  • 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
     

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

2 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
     
  • 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
     

23 Mar, 2006

5 commits

  • Add the SNAPSHOT_S2RAM ioctl to the snapshot device.

    This ioctl allows a userland application to make the system (previously frozen
    with the SNAPSHOT_FREE ioctl) enter the S3 state without freezing processes
    and disabling nonboot CPUs for the second time.

    This will allow us to implement the suspend-to-disk-and-RAM (STDR)
    functionality in the userland suspend tools.

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

    Luca Tettamanti
     
  • 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
     
  • Move externs from C source files to header files.

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

    Randy Dunlap
     
  • Move the swap-writing/reading code of swsusp to a separate file.

    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
     

08 Feb, 2006

1 commit


02 Feb, 2006

2 commits


07 Jan, 2006

6 commits

  • This makes the swsusp_info structure become the header of the image in the
    literal sense (ie. it is saved to the swap and read before any other image
    data with the help of the swsusp's swap map structure, so generally it is
    treated in the same way as the rest of the image).

    The main thing it does is to make swsusp_header contain the offset of the swap
    map used to track the image data pages rather than the offset of swsusp_info.
     Simultaneously, swsusp_info becomes the first image page written to the swap.

    The other changes are generally consequences of the above with a few
    exceptions (there's some consolidation in the image reading part as a few
    functions turn into trivial wrappers around something else).

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

    Rafael J. Wysocki
     
  • Make the suspend image size limit tunable via /sys/power/image_size.

    It is necessary for systems on which there is a limited amount of swap
    available for suspend. It can also be useful for optimizing performance of
    swsusp on systems with 1 GB of RAM or more.

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

    Rafael J. Wysocki
     
  • Limit the size of the suspend image to approx. 500 MB, which should
    improve the overall performance of swsusp on systems with more than 1 GB of
    RAM.

    It introduces the constant IMAGE_SIZE that can be set to the preferred size
    of the image (in MB) and modifies the memory-shrinking part of swsusp to
    take this constant into account (500 is the default value of IMAGE_SIZE).

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

    Rafael J. Wysocki
     
  • These two prototypes are already present in sched.h, remove duplicate
    version.

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

    Pavel Machek
     
  • 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
     

31 Oct, 2005

3 commits


28 Sep, 2005

1 commit

  • The following patch makes swsusp avoid problems during resume if there are
    too many pages to save on suspend. It adds a constant that allows us to
    verify if we are going to save too many pages and implements the check
    (this is done as early as we can tell that the check will trigger, which is
    in swsusp_alloc()).

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

    Rafael J. Wysocki
     

23 Sep, 2005

1 commit


17 Apr, 2005

1 commit

  • Initial git repository build. I'm not bothering with the full history,
    even though we have it. We can create a separate "historical" git
    archive of that later if we want to, and in the meantime it's about
    3.2GB when imported into git - space that would just make the early
    git days unnecessarily complicated, when we don't have a lot of good
    infrastructure for it.

    Let it rip!

    Linus Torvalds