alistair23-linux/drivers
Yasuaki Ishimatsu 6677e3eaf4 memory-hotplug: check whether all memory blocks are offlined or not when removing memory
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
panicked.

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: Wen Congyang <wency@cn.fujitsu.com>
Signed-off-by: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
Signed-off-by: Tang Chen <tangchen@cn.fujitsu.com>
Acked-by: KAMEZAWA 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: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2013-02-23 17:50:11 -08:00
..
accessibility
acpi Driver core patches for 3.9-rc1 2013-02-21 12:05:51 -08:00
amba
ata Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux 2013-02-21 17:54:03 -08:00
atm
auxdisplay
base memory-hotplug: check whether all memory blocks are offlined or not when removing memory 2013-02-23 17:50:11 -08:00
bcma Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless 2013-02-14 14:23:33 -05:00
block Driver core patches for 3.9-rc1 2013-02-21 12:05:51 -08:00
bluetooth Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial 2013-02-21 17:40:58 -08:00
bus
cdrom
char Char/Misc driver patches for 3.9-rc1 2013-02-21 13:57:13 -08:00
clk arm-soc: device tree conversions 2013-02-21 15:38:49 -08:00
clocksource arm-soc: virtualization changes 2013-02-21 15:40:16 -08:00
connector net: proc: change proc_net_remove to remove_proc_entry 2013-02-18 14:53:08 -05:00
cpufreq arm-soc: driver specific changes 2013-02-21 15:12:18 -08:00
cpuidle arm-soc: soc-specific updates 2013-02-21 15:27:22 -08:00
crypto
dca
devfreq
dio
dma arm-soc: soc-specific updates 2013-02-21 15:27:22 -08:00
edac Driver core patches for 3.9-rc1 2013-02-21 12:05:51 -08:00
eisa
extcon Char/Misc driver patches for 3.9-rc1 2013-02-21 13:57:13 -08:00
firewire Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial 2013-02-21 17:40:58 -08:00
firmware A few fixes to reduce places where pstore might hang 2013-02-21 09:38:18 -08:00
gpio Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux 2013-02-21 17:54:03 -08:00
gpu Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial 2013-02-21 17:40:58 -08:00
hid Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid 2013-02-21 17:41:38 -08:00
hsi
hv Char/Misc driver patches for 3.9-rc1 2013-02-21 13:57:13 -08:00
hwmon ACPI and power management updates for 3.9-rc1 2013-02-20 11:26:56 -08:00
hwspinlock
i2c arm-soc: soc-specific updates 2013-02-21 15:27:22 -08:00
ide Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial 2013-02-21 17:40:58 -08:00
idle Driver core patches for 3.9-rc1 2013-02-21 12:05:51 -08:00
iio Staging tree update for 3.9-rc1 2013-02-21 12:11:44 -08:00
infiniband Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial 2013-02-21 17:40:58 -08:00
input arm-soc: soc-specific updates 2013-02-21 15:27:22 -08:00
iommu Driver core patches for 3.9-rc1 2013-02-21 12:05:51 -08:00
ipack Char/Misc driver patches for 3.9-rc1 2013-02-21 13:57:13 -08:00
irqchip arm-soc: cleanups 2013-02-21 14:58:40 -08:00
isdn Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial 2013-02-21 17:40:58 -08:00
leds
lguest tty/serial patches for 3.9-rc1 2013-02-21 13:41:04 -08:00
macintosh
mailbox
md drivers/md/persistent-data/dm-transaction-manager.c: rename HASH_SIZE 2013-02-23 17:50:08 -08:00
media Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux 2013-02-21 17:54:03 -08:00
memory
memstick
message
mfd arm-soc: driver specific changes 2013-02-21 15:12:18 -08:00
misc Char/Misc driver patches for 3.9-rc1 2013-02-21 13:57:13 -08:00
mmc Char/Misc driver patches for 3.9-rc1 2013-02-21 13:57:13 -08:00
mtd arm-soc: device tree conversions 2013-02-21 15:38:49 -08:00
net Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux 2013-02-21 17:54:03 -08:00
nfc Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-next into for-davem 2013-02-18 13:47:13 -05:00
ntb
nubus
of Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial 2013-02-21 17:40:58 -08:00
oprofile
parisc
parport Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux 2013-02-21 17:54:03 -08:00
pci Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux 2013-02-21 17:54:03 -08:00
pcmcia Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial 2013-02-21 17:40:58 -08:00
pinctrl arm-soc: device tree conversions 2013-02-21 15:38:49 -08:00
platform Staging tree update for 3.9-rc1 2013-02-21 12:11:44 -08:00
pnp
power Staging tree update for 3.9-rc1 2013-02-21 12:11:44 -08:00
pps
ps3
ptp
pwm
rapidio
regulator Merge remote-tracking branch 'regulator/topic/tps65090' into regulator-next 2013-02-19 12:43:12 +00:00
remoteproc arm-soc: multiplatform support 2013-02-21 15:20:41 -08:00
rpmsg Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial 2013-02-21 17:40:58 -08:00
rtc Merge branch 'akpm' (incoming from Andrew) 2013-02-21 17:38:49 -08:00
s390 Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux 2013-02-21 17:54:03 -08:00
sbus
scsi Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial 2013-02-21 17:40:58 -08:00
sfi
sh
sn
spi arm-soc: soc-specific updates 2013-02-21 15:27:22 -08:00
ssb Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless 2013-02-14 14:23:33 -05:00
staging Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial 2013-02-21 17:40:58 -08:00
target Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial 2013-02-21 17:40:58 -08:00
tc
thermal
tty Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux 2013-02-21 17:54:03 -08:00
uio uio: remove !S390 dependency from Kconfig 2013-02-14 15:55:18 +01:00
usb arm-soc: soc-specific updates 2013-02-21 15:27:22 -08:00
uwb
vfio
vhost Driver core patches for 3.9-rc1 2013-02-21 12:05:51 -08:00
video Merge branch 'akpm' (incoming from Andrew) 2013-02-21 17:38:49 -08:00
virt
virtio
vlynq
vme vme: add missing put_device() after device_register() fails 2013-02-14 09:24:14 -08:00
w1 Char/Misc driver patches for 3.9-rc1 2013-02-21 13:57:13 -08:00
watchdog
xen Merge branch 'x86-mm-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2013-02-21 18:06:55 -08:00
zorro
Kconfig Char/Misc driver patches for 3.9-rc1 2013-02-21 13:57:13 -08:00
Makefile Char/Misc driver patches for 3.9-rc1 2013-02-21 13:57:13 -08:00