1. 19 7月, 2010 1 次提交
  2. 11 5月, 2010 1 次提交
  3. 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
  4. 27 2月, 2010 2 次提交
  5. 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
  6. 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
  7. 13 6月, 2009 1 次提交
  8. 01 4月, 2009 1 次提交
  9. 19 12月, 2008 3 次提交
  10. 25 7月, 2008 1 次提交
  11. 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
  12. 21 2月, 2008 1 次提交
  13. 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
  14. 02 2月, 2008 3 次提交
  15. 20 10月, 2007 1 次提交
  16. 19 10月, 2007 1 次提交
  17. 12 8月, 2007 1 次提交
  18. 10 5月, 2007 1 次提交
  19. 09 5月, 2007 2 次提交
  20. 08 5月, 2007 3 次提交
  21. 03 5月, 2007 1 次提交
    • V
      [PATCH] x86: Move swsusp __pa() dependent code to arch portion · 49c3df6a
      Vivek Goyal 提交于
      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: NVivek Goyal <vgoyal@in.ibm.com>
      Signed-off-by: NAndi Kleen <ak@suse.de>
      49c3df6a
  22. 12 2月, 2007 1 次提交
  23. 08 12月, 2006 3 次提交
    • R
      [PATCH] swsusp: Fix labels · 59a49335
      Rafael J. Wysocki 提交于
      Move all labels in the swsusp code to the second column, so that they won't
      fool diff -p.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      Acked-by: NPavel Machek <pavel@ucw.cz>
      Cc: Nigel Cunningham <nigel@suspend2.net>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      59a49335
    • R
      [PATCH] swsusp: Fix coding style in suspend.c · 5b6d15de
      Rafael J. Wysocki 提交于
      Fix coding style in suspend.c.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      Acked-by: NPavel Machek <pavel@ucw.cz>
      Cc: Nigel Cunningham <nigel@suspend2.net>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      5b6d15de
    • R
      [PATCH] swsusp: Improve handling of highmem · 8357376d
      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: NRafael J. Wysocki <rjw@sisk.pl>
      Cc: Pavel Machek <pavel@ucw.cz>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      8357376d
  24. 02 10月, 2006 1 次提交
    • S
      [PATCH] namespaces: utsname: use init_utsname when appropriate · 96b644bd
      Serge E. Hallyn 提交于
      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: NSerge E. Hallyn <serue@us.ibm.com>
      Cc: Kirill Korotaev <dev@openvz.org>
      Cc: "Eric W. Biederman" <ebiederm@xmission.com>
      Cc: Herbert Poetzl <herbert@13thfloor.at>
      Cc: Andrey Savochkin <saw@sw.ru>
      Cc: Serge Hallyn <serue@us.ibm.com>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      96b644bd
  25. 26 9月, 2006 2 次提交
    • R
      [PATCH] swsusp: Use memory bitmaps during resume · 940864dd
      Rafael J. Wysocki 提交于
      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: NRafael J. Wysocki <rjw@sisk.pl>
      Acked-by: NPavel Machek <pavel@ucw.cz>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      940864dd
    • R
      [PATCH] swsusp: Introduce memory bitmaps · b788db79
      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: NRafael J. Wysocki <rjw@sisk.pl>
      Acked-by: NPavel Machek <pavel@ucw.cz>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      b788db79