1. 20 3月, 2012 1 次提交
  2. 18 2月, 2012 1 次提交
  3. 20 1月, 2012 1 次提交
  4. 11 1月, 2012 1 次提交
  5. 17 10月, 2011 1 次提交
  6. 07 7月, 2011 1 次提交
    • R
      PM / Hibernate: Fix free_unnecessary_pages() · 4d4cf23c
      Rafael J. Wysocki 提交于
      There is a bug in free_unnecessary_pages() that causes it to
      attempt to free too many pages in some cases, which triggers the
      BUG_ON() in memory_bm_clear_bit() for copy_bm.  Namely, if
      count_data_pages() is initially greater than alloc_normal, we get
      to_free_normal equal to 0 and "save" greater from 0.  In that case,
      if the sum of "save" and count_highmem_pages() is greater than
      alloc_highmem, we subtract a positive number from to_free_normal.
      Hence, since to_free_normal was 0 before the subtraction and is
      an unsigned int, the result is converted to a huge positive number
      that is used as the number of pages to free.
      
      Fix this bug by checking if to_free_normal is actually greater
      than or equal to the number we're going to subtract from it.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      Reported-and-tested-by: NMatthew Garrett <mjg@redhat.com>
      Cc: stable@kernel.org
      4d4cf23c
  7. 18 5月, 2011 2 次提交
    • R
      Revert "PM / Hibernate: Reduce autotuned default image size" · 1c1be3a9
      Rafael J. Wysocki 提交于
      This reverts commit bea3864f
      (PM / Hibernate: Reduce autotuned default image size), because users
      are now able to resolve the issue this commit was supposed to address
      in a different way (i.e. by using the new /sys/power/reserved_size
      interface).
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      1c1be3a9
    • R
      PM / Hibernate: Add sysfs knob to control size of memory for drivers · ddeb6487
      Rafael J. Wysocki 提交于
      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=34102Reported-and-tested-by: NMartin Steigerwald <Martin@Lichtvoll.de>
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      ddeb6487
  8. 15 3月, 2011 1 次提交
  9. 17 2月, 2011 1 次提交
  10. 27 10月, 2010 2 次提交
  11. 17 10月, 2010 2 次提交
  12. 12 9月, 2010 1 次提交
    • R
      PM / Hibernate: Avoid hitting OOM during preallocation of memory · 6715045d
      Rafael J. Wysocki 提交于
      There is a problem in hibernate_preallocate_memory() that it calls
      preallocate_image_memory() with an argument that may be greater than
      the total number of available non-highmem memory pages.  If that's
      the case, the OOM condition is guaranteed to trigger, which in turn
      can cause significant slowdown to occur during hibernation.
      
      To avoid that, make preallocate_image_memory() adjust its argument
      before calling preallocate_image_pages(), so that the total number of
      saveable non-highem pages left is not less than the minimum size of
      a hibernation image.  Change hibernate_preallocate_memory() to try to
      allocate from highmem if the number of pages allocated by
      preallocate_image_memory() is too low.
      
      Modify free_unnecessary_pages() to take all possible memory
      allocation patterns into account.
      Reported-by: NKOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      Tested-by: NM. Vefa Bicakci <bicave@superonline.com>
      6715045d
  13. 10 9月, 2010 1 次提交
    • H
      swap: revert special hibernation allocation · 910321ea
      Hugh Dickins 提交于
      Please revert 2.6.36-rc commit d2997b10
      "hibernation: freeze swap at hibernation".  It complicated matters by
      adding a second swap allocation path, just for hibernation; without in any
      way fixing the issue that it was intended to address - page reclaim after
      fixing the hibernation image might free swap from a page already imaged as
      swapcache, letting its swap be reallocated to store a different page of
      the image: resulting in data corruption if the imaged page were freed as
      clean then swapped back in.  Pages freed to si->swap_map were still in
      danger of being reallocated by the alternative allocation path.
      
      I guess it inadvertently fixed slow SSD swap allocation for hibernation,
      as reported by Nigel Cunningham: by missing out the discards that occur on
      the usual swap allocation path; but that was unintentional, and needs a
      separate fix.
      Signed-off-by: NHugh Dickins <hughd@google.com>
      Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
      Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
      Cc: "Rafael J. Wysocki" <rjw@sisk.pl>
      Cc: Ondrej Zary <linux@rainbow-software.org>
      Cc: Andrea Gelmini <andrea.gelmini@gmail.com>
      Cc: Balbir Singh <balbir@in.ibm.com>
      Cc: Andrea Arcangeli <aarcange@redhat.com>
      Cc: Nigel Cunningham <nigel@tuxonice.net>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      910321ea
  14. 10 8月, 2010 1 次提交
    • K
      hibernation: freeze swap at hibernation · d2997b10
      KAMEZAWA Hiroyuki 提交于
      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: NKAMEZAWA 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: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      d2997b10
  15. 19 7月, 2010 1 次提交
  16. 11 5月, 2010 1 次提交
  17. 30 3月, 2010 1 次提交
    • T
      include cleanup: Update gfp.h and slab.h includes to prepare for breaking... · 5a0e3ad6
      Tejun Heo 提交于
      include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h
      
      percpu.h is included by sched.h and module.h and thus ends up being
      included when building most .c files.  percpu.h includes slab.h which
      in turn includes gfp.h making everything defined by the two files
      universally available and complicating inclusion dependencies.
      
      percpu.h -> slab.h dependency is about to be removed.  Prepare for
      this change by updating users of gfp and slab facilities include those
      headers directly instead of assuming availability.  As this conversion
      needs to touch large number of source files, the following script is
      used as the basis of conversion.
      
        http://userweb.kernel.org/~tj/misc/slabh-sweep.py
      
      The script does the followings.
      
      * Scan files for gfp and slab usages and update includes such that
        only the necessary includes are there.  ie. if only gfp is used,
        gfp.h, if slab is used, slab.h.
      
      * When the script inserts a new include, it looks at the include
        blocks and try to put the new include such that its order conforms
        to its surrounding.  It's put in the include block which contains
        core kernel includes, in the same order that the rest are ordered -
        alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
        doesn't seem to be any matching order.
      
      * If the script can't find a place to put a new include (mostly
        because the file doesn't have fitting include block), it prints out
        an error message indicating which .h file needs to be added to the
        file.
      
      The conversion was done in the following steps.
      
      1. The initial automatic conversion of all .c files updated slightly
         over 4000 files, deleting around 700 includes and adding ~480 gfp.h
         and ~3000 slab.h inclusions.  The script emitted errors for ~400
         files.
      
      2. Each error was manually checked.  Some didn't need the inclusion,
         some needed manual addition while adding it to implementation .h or
         embedding .c file was more appropriate for others.  This step added
         inclusions to around 150 files.
      
      3. The script was run again and the output was compared to the edits
         from #2 to make sure no file was left behind.
      
      4. Several build tests were done and a couple of problems were fixed.
         e.g. lib/decompress_*.c used malloc/free() wrappers around slab
         APIs requiring slab.h to be added manually.
      
      5. The script was run on all .h files but without automatically
         editing them as sprinkling gfp.h and slab.h inclusions around .h
         files could easily lead to inclusion dependency hell.  Most gfp.h
         inclusion directives were ignored as stuff from gfp.h was usually
         wildly available and often used in preprocessor macros.  Each
         slab.h inclusion directive was examined and added manually as
         necessary.
      
      6. percpu.h was updated not to include slab.h.
      
      7. Build test were done on the following configurations and failures
         were fixed.  CONFIG_GCOV_KERNEL was turned off for all tests (as my
         distributed build env didn't work with gcov compiles) and a few
         more options had to be turned off depending on archs to make things
         build (like ipr on powerpc/64 which failed due to missing writeq).
      
         * x86 and x86_64 UP and SMP allmodconfig and a custom test config.
         * powerpc and powerpc64 SMP allmodconfig
         * sparc and sparc64 SMP allmodconfig
         * ia64 SMP allmodconfig
         * s390 SMP allmodconfig
         * alpha SMP allmodconfig
         * um on x86_64 SMP allmodconfig
      
      8. percpu.h modifications were reverted so that it could be applied as
         a separate patch and serve as bisection point.
      
      Given the fact that I had only a couple of failures from tests on step
      6, I'm fairly confident about the coverage of this conversion patch.
      If there is a breakage, it's likely to be something in one of the arch
      headers which should be easily discoverable easily on most builds of
      the specific arch.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Guess-its-ok-by: NChristoph Lameter <cl@linux-foundation.org>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
      5a0e3ad6
  18. 27 2月, 2010 2 次提交
  19. 22 9月, 2009 1 次提交
    • J
      mm: don't use alloc_bootmem_low() where not strictly needed · 3c1596ef
      Jan Beulich 提交于
      Since alloc_bootmem() will never return inaccessible (via virtual
      addressing) memory anyway, using the ..._low() variant only makes sense
      when the physical address range of the allocated memory must fulfill
      further constraints, espacially since on 64-bits (or more generally in all
      cases where the pools the two variants allocate from are than the full
      available range.
      
      Probably the use in alloc_tce_table() could also be eliminated (based on
      code inspection of pci-calgary_64.c), but that seems too risky given I
      know nothing about that hardware and have no way to test it.
      Signed-off-by: NJan Beulich <jbeulich@novell.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      3c1596ef
  20. 15 9月, 2009 5 次提交
    • W
      PM: Trivial fixes · 8de03073
      Wu Fengguang 提交于
      Fix the definition of BM_BITS_PER_BLOCK and kerneldoc
      description of create_bm_block_list().
      
      [rjw: Added changelog.]
      Signed-off-by: NWu Fengguang <fengguang.wu@intel.com>
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      8de03073
    • G
      PM / Hibernate / Memory hotplug: Always use for_each_populated_zone() · 98e73dc5
      Gerald Schaefer 提交于
      Use for_each_populated_zone() instead of for_each_zone() in hibernation
      code. This fixes a bug on s390, where we allow both config options
      HIBERNATION and MEMORY_HOTPLUG, so that we also have a ZONE_MOVABLE
      here. We only allow hibernation if no memory hotplug operation was
      performed, so in fact both features can only be used exclusively, but
      this way we don't need 2 differently configured (distribution) kernels.
      
      If we have an unpopulated ZONE_MOVABLE, we allow hibernation but run
      into a BUG_ON() in memory_bm_test/set/clear_bit() because hibernation
      code iterates through all zones, not only the populated zones, in
      several places. For example, swsusp_free() does for_each_zone() and
      then checks for pfn_valid(), which is true even if the zone is not
      populated, resulting in a BUG_ON() later because the pfn cannot be
      found in the memory bitmap.
      
      Replacing all occurences of for_each_zone() in hibernation code with
      for_each_populated_zone() would fix this issue.
      
      [rjw: Rebased on top of linux-next hibernation patches.]
      Signed-off-by: NGerald Schaefer <gerald.schaefer@de.ibm.com>
      Acked-by: NKOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      98e73dc5
    • R
      PM/Hibernate: Do not try to allocate too much memory too hard (rev. 2) · ef4aede3
      Rafael J. Wysocki 提交于
      We want to avoid attempting to free too much memory too hard during
      hibernation, so estimate the minimum size of the image to use as the
      lower limit for preallocating memory.
      
      The approach here is based on the (experimental) observation that we
      can't free more page frames than the sum of:
      
      * global_page_state(NR_SLAB_RECLAIMABLE)
      * global_page_state(NR_ACTIVE_ANON)
      * global_page_state(NR_INACTIVE_ANON)
      * global_page_state(NR_ACTIVE_FILE)
      * global_page_state(NR_INACTIVE_FILE)
      
      minus
      
      * global_page_state(NR_FILE_MAPPED)
      
      Namely, if this number is subtracted from the number of saveable
      pages in the system, we get a good estimate of the minimum reasonable
      size of a hibernation image.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      Acked-by: NWu Fengguang <fengguang.wu@intel.com>
      ef4aede3
    • R
      PM/Hibernate: Do not release preallocated memory unnecessarily (rev. 2) · 64a473cb
      Rafael J. Wysocki 提交于
      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: NRafael J. Wysocki <rjw@sisk.pl>
      64a473cb
    • R
      PM/Hibernate: Rework shrinking of memory · 4bb33435
      Rafael J. Wysocki 提交于
      Rework swsusp_shrink_memory() so that it calls shrink_all_memory()
      just once to make some room for the image and then allocates memory
      to apply more pressure to the memory management subsystem, if
      necessary.
      
      Unfortunately, we don't seem to be able to drop shrink_all_memory()
      entirely just yet, because that would lead to huge performance
      regressions in some test cases.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      Acked-by: NPavel Machek <pavel@ucw.cz>
      4bb33435
  21. 13 6月, 2009 1 次提交
  22. 01 4月, 2009 1 次提交
  23. 19 12月, 2008 3 次提交
  24. 25 7月, 2008 1 次提交
  25. 12 3月, 2008 1 次提交
    • R
      Hibernation: Fix mark_nosave_pages() · a82f7119
      Rafael J. Wysocki 提交于
      There is a problem in the hibernation code that triggers on some NUMA
      systems on which pfn_valid() returns 'true' for some PFNs that don't
      belong to any zone.  Namely, there is a BUG_ON() in
      memory_bm_find_bit() that triggers for PFNs not belonging to any
      zone and passing the pfn_valid() test.  On the affected systems it
      triggers when we mark PFNs reported by the platform as not saveable,
      because the PFNs in question belong to a region mapped directly using
      iorepam() (i.e. the ACPI data area) and they pass the pfn_valid()
      test.
      
      Modify memory_bm_find_bit() so that it returns an error if given PFN
      doesn't belong to any zone instead of crashing the kernel and ignore
      the result returned by it in mark_nosave_pages(), while marking the
      "nosave" memory regions.
      
      This doesn't affect the hibernation functionality, as we won't touch
      the PFNs in question anyway.
      
      http://bugzilla.kernel.org/show_bug.cgi?id=9966 .
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      Signed-off-by: NLen Brown <len.brown@intel.com>
      a82f7119
  26. 21 2月, 2008 1 次提交
  27. 06 2月, 2008 1 次提交
    • C
      Page allocator: clean up pcp draining functions · 9f8f2172
      Christoph Lameter 提交于
      - Add comments explaing how drain_pages() works.
      
      - Eliminate useless functions
      
      - Rename drain_all_local_pages to drain_all_pages(). It does drain
        all pages not only those of the local processor.
      
      - Eliminate useless interrupt off / on sequences. drain_pages()
        disables interrupts on its own. The execution thread is
        pinned to processor by the caller. So there is no need to
        disable interrupts.
      
      - Put drain_all_pages() declaration in gfp.h and remove the
        declarations from suspend.h and from mm/memory_hotplug.c
      
      - Make software suspend call drain_all_pages(). The draining
        of processor local pages is may not the right approach if
        software suspend wants to support SMP. If they call drain_all_pages
        then we can make drain_pages() static.
      
      [akpm@linux-foundation.org: fix build]
      Signed-off-by: NChristoph Lameter <clameter@sgi.com>
      Acked-by: NMel Gorman <mel@csn.ul.ie>
      Cc: "Rafael J. Wysocki" <rjw@sisk.pl>
      Cc: Daniel Walker <dwalker@mvista.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      9f8f2172
  28. 02 2月, 2008 3 次提交