1. 29 Apr, 2013 2 commits
  2. 24 Feb, 2013 1 commit
    • Yasuaki Ishimatsu's avatar
      memory-hotplug: check whether all memory blocks are offlined or not when removing memory · 6677e3ea
      Yasuaki Ishimatsu authored
      We remove the memory like this:
       1. lock memory hotplug
       2. offline a memory block
       3. unlock memory hotplug
       4. repeat 1-3 to offline all memory blocks
       5. lock memory hotplug
       6. remove memory(TODO)
       7. unlock memory hotplug
      All memory blocks must be offlined before removing memory.  But we don't
      hold the lock in the whole operation.  So we should check whether all
      memory blocks are offlined before step6.  Otherwise, kernel maybe
      Offlining a memory block and removing a memory device can be two
      different operations.  Users can just offline some memory blocks without
      removing the memory device.  For this purpose, the kernel has held
      lock_memory_hotplug() in __offline_pages().  To reuse the code for
      memory hot-remove, we repeat step 1-3 to offline all the memory blocks,
      repeatedly lock and unlock memory hotplug, but not hold the memory
      hotplug lock in the whole operation.
      Signed-off-by: default avatarWen Congyang <wency@cn.fujitsu.com>
      Signed-off-by: default avatarYasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
      Signed-off-by: default avatarTang Chen <tangchen@cn.fujitsu.com>
      Acked-by: default avatarKAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
      Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
      Cc: Jiang Liu <jiang.liu@huawei.com>
      Cc: Jianguo Wu <wujianguo@huawei.com>
      Cc: Kamezawa Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
      Cc: Lai Jiangshan <laijs@cn.fujitsu.com>
      Cc: Wu Jianguo <wujianguo@huawei.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
  3. 18 Feb, 2013 1 commit
  4. 12 Dec, 2012 2 commits
    • Lai Jiangshan's avatar
      mm, memory-hotplug: dynamic configure movable memory and portion memory · 511c2aba
      Lai Jiangshan authored
      Add online_movable and online_kernel for logic memory hotplug.  This is
      the dynamic version of "movablecore" & "kernelcore".
      We have the same reason to introduce it as to introduce "movablecore" &
      "kernelcore".  It has the same motive as "movablecore" & "kernelcore", but
      it is dynamic/running-time:
      o We can configure memory as kernelcore or movablecore after boot.
        Userspace workload is increased, we need more hugepage, we can't use
        "online_movable" to add memory and allow the system use more
        THP(transparent-huge-page), vice-verse when kernel workload is increase.
        Also help for virtualization to dynamic configure host/guest's memory,
        to save/(reduce waste) memory.
        Memory capacity on Demand
      o When a new node is physically online after boot, we need to use
        "online_movable" or "online_kernel" to configure/portion it as we
        expected when we logic-online it.
        This configuration also helps for physically-memory-migrate.
      o all benefit as the same as existed "movablecore" & "kernelcore".
      o Preparing for movable-node, which is very important for power-saving,
        hardware partitioning and high-available-system(hardware fault
      (Note, we don't introduce movable-node here.)
      Action behavior:
      When a memoryblock/memorysection is onlined by "online_movable", the kernel
      will not have directly reference to the page of the memoryblock,
      thus we can remove that memory any time when needed.
      When it is online by "online_kernel", the kernel can use it.
      When it is online by "online", the zone type doesn't changed.
      Current constraints:
      Only the memoryblock which is adjacent to the ZONE_MOVABLE
      can be online from ZONE_NORMAL to ZONE_MOVABLE.
      [akpm@linux-foundation.org: use min_t, cleanups]
      Signed-off-by: default avatarLai Jiangshan <laijs@cn.fujitsu.com>
      Signed-off-by: default avatarWen Congyang <wency@cn.fujitsu.com>
      Cc: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
      Cc: Lai Jiangshan <laijs@cn.fujitsu.com>
      Cc: Jiang Liu <jiang.liu@huawei.com>
      Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
      Cc: Minchan Kim <minchan.kim@gmail.com>
      Cc: Mel Gorman <mgorman@suse.de>
      Cc: David Rientjes <rientjes@google.com>
      Cc: Yinghai Lu <yinghai@kernel.org>
      Cc: Rusty Russell <rusty@rustcorp.com.au>
      Cc: Greg KH <greg@kroah.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    • Yasuaki Ishimatsu's avatar
      memory hotplug: suppress "Device memoryX does not have a release() function" warning · fa7194eb
      Yasuaki Ishimatsu authored
      When calling remove_memory_block(), the function shows following message
      at device_release().
      "Device 'memory528' does not have a release() function, it is broken and
      must be fixed."
      The reason is memory_block's device struct does not have a release()
      So the patch registers memory_block_release() to the device's release()
      function for suppressing the warning message.  Additionally, the patch
      moves kfree(mem) into the release function since the release function is
      prepared as a means to free a memory_block struct.
      Signed-off-by: default avatarYasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
      Acked-by: default avatarDavid Rientjes <rientjes@google.com>
      Cc: Jiang Liu <liuj97@gmail.com>
      Cc: Minchan Kim <minchan.kim@gmail.com>
      Acked-by: default avatarKOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
      Cc: Wen Congyang <wency@cn.fujitsu.com>
      Cc: Greg KH <greg@kroah.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
  5. 09 Oct, 2012 2 commits
    • Wen Congyang's avatar
      memory-hotplug: update memory block's state and notify userspace · e90bdb7f
      Wen Congyang authored
      remove_memory() will be called when hot removing a memory device.  But
      even if offlining memory, we cannot notice it.  So the patch updates the
      memory block's state and sends notification to userspace.
      Additionally, the memory device may contain more than one memory block.
      If the memory block has been offlined, __offline_pages() will fail.  So we
      should try to offline one memory block at a time.
      Thus remove_memory() also check each memory block's state.  So there is no
      need to check the memory block's state before calling remove_memory().
      Signed-off-by: default avatarWen Congyang <wency@cn.fujitsu.com>
      Signed-off-by: default avatarYasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
      Cc: David Rientjes <rientjes@google.com>
      Cc: Jiang Liu <liuj97@gmail.com>
      Cc: Len Brown <len.brown@intel.com>
      Cc: Christoph Lameter <cl@linux.com>
      Cc: Minchan Kim <minchan.kim@gmail.com>
      Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    • Wen Congyang's avatar
      memory-hotplug: preparation to notify memory block's state at memory hot remove · a16cee10
      Wen Congyang authored
      remove_memory() is called in two cases:
      1. echo offline >/sys/devices/system/memory/memoryXX/state
      2. hot remove a memory device
      In the 1st case, the memory block's state is changed and the notification
      that memory block's state changed is sent to userland after calling
      remove_memory().  So user can notice memory block is changed.
      But in the 2nd case, the memory block's state is not changed and the
      notification is not also sent to userspcae even if calling
      remove_memory().  So user cannot notice memory block is changed.
      For adding the notification at memory hot remove, the patch just prepare
      as follows:
      1st case uses offline_pages() for offlining memory.
      2nd case uses remove_memory() for offlining memory and changing memory block's
          state and notifing the information.
      The patch does not implement notification to remove_memory().
      Signed-off-by: default avatarWen Congyang <wency@cn.fujitsu.com>
      Signed-off-by: default avatarYasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
      Cc: David Rientjes <rientjes@google.com>
      Cc: Jiang Liu <liuj97@gmail.com>
      Cc: Len Brown <len.brown@intel.com>
      Cc: Christoph Lameter <cl@linux.com>
      Cc: Minchan Kim <minchan.kim@gmail.com>
      Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
  6. 02 Feb, 2012 1 commit
    • Yinghai Lu's avatar
      drivers/base/memory.c: fix memory_dev_init() long delay · 321bf4ed
      Yinghai Lu authored
      One system with 2048g ram, reported soft lockup on recent kernel.
      [   34.426749] cpu_dev_init done
      [   61.166399] BUG: soft lockup - CPU#0 stuck for 22s! [swapper/0:1]
      [   61.166733] Modules linked in:
      [   61.166904] irq event stamp: 1935610
      [   61.178431] hardirqs last  enabled at (1935609): [<ffffffff81ce8c05>] mutex_lock_nested+0x299/0x2b4
      [   61.178923] hardirqs last disabled at (1935610): [<ffffffff81cf2bab>] apic_timer_interrupt+0x6b/0x80
      [   61.198767] softirqs last  enabled at (1935476): [<ffffffff8106e59c>] __do_softirq+0x195/0x1ab
      [   61.218604] softirqs last disabled at (1935471): [<ffffffff81cf359c>] call_softirq+0x1c/0x30
      [   61.238408] CPU 0
      [   61.238549] Modules linked in:
      [   61.238744]
      [   61.238825] Pid: 1, comm: swapper/0 Not tainted 3.3.0-rc1-tip-yh-02076-g962f689-dirty #171
      [   61.278212] RIP: 0010:[<ffffffff810b3e3a>]  [<ffffffff810b3e3a>] lock_release+0x90/0x9c
      [   61.278627] RSP: 0018:ffff883f64dbfd70  EFLAGS: 00000246
      [   61.298287] RAX: ffff883f64dc0000 RBX: 0000000000000000 RCX: 000000000000008b
      [   61.298690] RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000
      [   61.318383] RBP: ffff883f64dbfda0 R08: 0000000000000001 R09: 000000000000008b
      [   61.338215] R10: 0000000000000000 R11: 0000000000000000 R12: ffff883f64dbfd10
      [   61.338610] R13: ffff883f64dc0708 R14: ffff883f64dc0708 R15: ffffffff81095657
      [   61.358299] FS:  0000000000000000(0000) GS:ffff883f7d600000(0000) knlGS:0000000000000000
      [   61.378118] CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
      [   61.378450] CR2: 0000000000000000 CR3: 00000000024af000 CR4: 00000000000007f0
      [   61.398144] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
      [   61.417918] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
      [   61.418260] Process swapper/0 (pid: 1, threadinfo ffff883f64dbe000, task ffff883f64dc0000)
      [   61.445358] Stack:
      [   61.445511]  0000000000000002 ffff897f649ba168 ffff883f64dbfe10 ffff88ff64bb57a8
      [   61.458040]  0000000000000000 0000000000000000 ffff883f64dbfdc0 ffffffff81ceb1b4
      [   61.458491]  000000000011608c ffff88ff64bb58a8 ffff883f64dbfdf0 ffffffff81c57638
      [   61.478215] Call Trace:
      [   61.478367]  [<ffffffff81ceb1b4>] _raw_spin_unlock+0x21/0x2e
      [   61.497994]  [<ffffffff81c57638>] klist_next+0x9e/0xbc
      [   61.498264]  [<ffffffff8148ba99>] next_device+0xe/0x1e
      [   61.517867]  [<ffffffff8148c0cc>] subsys_find_device_by_id+0xb7/0xd6
      [   61.518197]  [<ffffffff81498846>] find_memory_block_hinted+0x3d/0x66
      [   61.537927]  [<ffffffff8149887f>] find_memory_block+0x10/0x12
      [   61.538193]  [<ffffffff814988b6>] add_memory_section+0x35/0x9e
      [   61.557932]  [<ffffffff827fecef>] memory_dev_init+0x68/0xda
      [   61.558227]  [<ffffffff827fec01>] driver_init+0x97/0xa7
      [   61.577853]  [<ffffffff827cdf3c>] kernel_init+0xf6/0x1c0
      [   61.578140]  [<ffffffff81cf34a4>] kernel_thread_helper+0x4/0x10
      [   61.597850]  [<ffffffff81ceb59d>] ? retint_restore_args+0xe/0xe
      [   61.598144]  [<ffffffff827cde46>] ? start_kernel+0x3ab/0x3ab
      [   61.617826]  [<ffffffff81cf34a0>] ? gs_change+0xb/0xb
      [   61.618060] Code: 10 48 83 3b 00 eb e8 4c 89 f2 44 89 fe 4c 89 ef e8 e1 fe ff ff 65 48 8b 04 25 40 bc 00 00 c7 80 cc 06 00 00 00 00 00 00 41 54 9d <5e> 5b 41 5c 41 5d 41 5e 41 5f 5d c3 55 48 89 e5 41 57 41 89 cf
      [   89.285380] memory_dev_init done
      Finally it takes about 55s to create 16400 memory entries.
      Root cause: for x86_64, 2048g (with 2g hole at [2g,4g), and TOP2 will be 2050g), will have 16400 memory block.
      find_memory_block/subsys_find_device_by_id will be expensive with that many entries.
      Actually, we don't need to find that memory block for BOOT path.
      Skip that finding make it get back to normal.
      [   34.466696] cpu_dev_init done
      [   35.290080] memory_dev_init done
      Also solved the delay with topology_init when sections_per_block is not 1.
      Signed-off-by: default avatarYinghai Lu <yinghai@kernel.org>
      Cc: Kay Sievers <kay.sievers@vrfy.org>
      Cc: Nathan Fontenot <nfont@austin.ibm.com>
      Cc: Robin Holt <holt@sgi.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
  7. 13 Jan, 2012 1 commit
    • Michael Holzheu's avatar
      kdump: add udev events for memory online/offline · f5138e42
      Michael Holzheu authored
      Currently no udev events for memory hotplug "online" and "offline" are
        # udevadm monitor
        # echo offline > /sys/devices/system/memory/memory4/state
        ==> No event
      When kdump is loaded, kexec detects the current memory configuration and
      stores it in the pre-allocated ELF core header.  Therefore, for kdump it
      is necessary to reload the kdump kernel with kexec when the memory
      configuration changes (e.g.  for online/offline hotplug memory).
      In order to do this automatically, udev rules should be used.  This kernel
      patch adds udev events for "online" and "offline".  Together with this
      kernel patch, the following udev rules for online/offline have to be added
      to "/etc/udev/rules.d/98-kexec.rules":
        SUBSYSTEM=="memory", ACTION=="online", PROGRAM="/etc/init.d/kdump restart"
        SUBSYSTEM=="memory", ACTION=="offline", PROGRAM="/etc/init.d/kdump restart"
      [sfr@canb.auug.org.au: fixups for class to subsystem conversion]
      Signed-off-by: default avatarMichael Holzheu <holzheu@linux.vnet.ibm.com>
      Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
      Cc: Vivek Goyal <vgoyal@redhat.com>
      Cc: "Eric W. Biederman" <ebiederm@xmission.com>
      Cc: Kay Sievers <kay.sievers@vrfy.org>
      Cc: Dave Hansen <haveblue@us.ibm.com>
      Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
      Cc: Greg KH <greg@kroah.com>
      Signed-off-by: default avatarStephen Rothwell <sfr@canb.auug.org.au>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
  8. 03 Jan, 2012 1 commit
    • Tony Luck's avatar
      HWPOISON: Clean up memory_failure() vs. __memory_failure() · cd42f4a3
      Tony Luck authored
      There is only one caller of memory_failure(), all other users call
      __memory_failure() and pass in the flags argument explicitly. The
      lone user of memory_failure() will soon need to pass flags too.
      Add flags argument to the callsite in mce.c. Delete the old memory_failure()
      function, and then rename __memory_failure() without the leading "__".
      Provide clearer message when action optional memory errors are ignored.
      Acked-by: default avatarBorislav Petkov <bp@amd64.org>
      Signed-off-by: default avatarTony Luck <tony.luck@intel.com>
  9. 21 Dec, 2011 1 commit
  10. 18 Oct, 2011 2 commits
  11. 26 Sep, 2011 2 commits
  12. 26 Jul, 2011 1 commit
  13. 12 Jul, 2011 1 commit
  14. 12 May, 2011 1 commit
  15. 11 May, 2011 1 commit
    • Anton Blanchard's avatar
      memory hotplug: Speed up add/remove when blocks are larger than PAGES_PER_SECTION · 5409d2cd
      Anton Blanchard authored
      On ppc64 the minimum memory section for hotplug is 16MB but most
      recent machines have a memory block size of 256MB. This means
      memory_block_change_state does 16 separate calls to
      This also means we call the notifiers 16 times and the hook
      in the ehea network driver is quite costly. To offline one 256MB
      region takes:
      # time echo offline > /sys/devices/system/memory/memory32/state
      This patch removes the loop and calls online_pages or
      remove_memory once for the entire region and in doing so makes
      the logic simpler since we don't have to back out if things fail
      part way through.
      The same test to offline one region now takes:
      # time echo online > /sys/devices/system/memory/memory32/state
      Over 11 times faster.
      Signed-off-by: default avatarAnton Blanchard <anton@samba.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
  16. 25 Apr, 2011 1 commit
  17. 10 Apr, 2011 1 commit
  18. 04 Feb, 2011 3 commits
  19. 22 Oct, 2010 4 commits
  20. 09 Apr, 2010 1 commit
  21. 30 Mar, 2010 1 commit
    • Tejun Heo's avatar
      include cleanup: Update gfp.h and slab.h includes to prepare for breaking... · 5a0e3ad6
      Tejun Heo authored
      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.
      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
      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
      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
      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: default avatarTejun Heo <tj@kernel.org>
      Guess-its-ok-by: default avatarChristoph Lameter <cl@linux-foundation.org>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
  22. 18 Mar, 2010 1 commit
    • Heiko Carstens's avatar
      memory hotplug: allow setting of phys_device · bc32df00
      Heiko Carstens authored
      /sys/devices/system/memory/memoryX/phys_device is supposed to contain the
      number of the physical device that the corresponding piece of memory
      belongs to.
      In case a physical device should be replaced or taken offline for whatever
      reason it is necessary to set all corresponding memory pieces offline.
      The current implementation always sets phys_device to '0' and there is no
      way or hook to change that.  Seems like there was a plan to implement that
      but it wasn't finished for whatever reason.
      So add a weak function which architectures can override to actually set
      the phys_device from within add_memory_block().
      Signed-off-by: default avatarHeiko Carstens <heiko.carstens@de.ibm.com>
      Cc: Dave Hansen <haveblue@us.ibm.com>
      Cc: Gerald Schaefer <gerald.schaefer@de.ibm.com>
      Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
  23. 08 Mar, 2010 3 commits
  24. 20 Jan, 2010 1 commit
  25. 16 Jan, 2010 2 commits
  26. 18 Dec, 2009 1 commit
    • Robert Jennings's avatar
      mm: Add notifier in pageblock isolation for balloon drivers · 925cc71e
      Robert Jennings authored
      Memory balloon drivers can allocate a large amount of memory which is not
      movable but could be freed to accomodate memory hotplug remove.
      Prior to calling the memory hotplug notifier chain the memory in the
      pageblock is isolated.  Currently, if the migrate type is not
      MIGRATE_MOVABLE the isolation will not proceed, causing the memory removal
      for that page range to fail.
      Rather than failing pageblock isolation if the migrateteype is not
      MIGRATE_MOVABLE, this patch checks if all of the pages in the pageblock,
      and not on the LRU, are owned by a registered balloon driver (or other
      entity) using a notifier chain.  If all of the non-movable pages are owned
      by a balloon, they can be freed later through the memory notifier chain
      and the range can still be isolated in set_migratetype_isolate().
      Signed-off-by: default avatarRobert Jennings <rcj@linux.vnet.ibm.com>
      Cc: Mel Gorman <mel@csn.ul.ie>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Brian King <brking@linux.vnet.ibm.com>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
      Cc: Gerald Schaefer <geralds@linux.vnet.ibm.com>
      Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
  27. 16 Dec, 2009 1 commit
    • Andi Kleen's avatar
      HWPOISON: Add soft page offline support · facb6011
      Andi Kleen authored
      This is a simpler, gentler variant of memory_failure() for soft page
      offlining controlled from user space.  It doesn't kill anything, just
      tries to invalidate and if that doesn't work migrate the
      page away.
      This is useful for predictive failure analysis, where a page has
      a high rate of corrected errors, but hasn't gone bad yet. Instead
      it can be offlined early and avoided.
      The offlining is controlled from sysfs, including a new generic
      entry point for hard page offlining for symmetry too.
      We use the page isolate facility to prevent re-allocation
      race. Normally this is only used by memory hotplug. To avoid
      races with memory allocation I am using lock_system_sleep().
      This avoids the situation where memory hotplug is about
      to isolate a page range and then hwpoison undoes that work.
      This is a big hammer currently, but the simplest solution
      When the page is not free or LRU we try to free pages
      from slab and other caches. The slab freeing is currently
      quite dumb and does not try to focus on the specific slab
      cache which might own the page. This could be potentially
      improved later.
      Thanks to Fengguang Wu and Haicheng Li for some fixes.
      [Added fix from Andrew Morton to adapt to new migrate_pages prototype]
      Signed-off-by: default avatarAndi Kleen <ak@linux.intel.com>