mirror of
https://github.com/torvalds/linux.git
synced 2024-11-16 09:02:00 +00:00
e8d1955258
On linux, the pages used by kernel could not be migrated. As a result, if a memory range is used by kernel, it cannot be hot-removed. So if we want to hot-remove memory, we should prevent kernel from using it. The way now used to prevent this is specify a memory range by movablemem_map boot option and set it as ZONE_MOVABLE. But when the system is booting, memblock will allocate memory, and reserve the memory for kernel. And before we parse SRAT, and know the node memory ranges, memblock is working. And it may allocate memory in ranges to be set as ZONE_MOVABLE. This memory can be used by kernel, and never be freed. So, let's parse SRAT before memblock is called first. And it is early enough. The first call of memblock_find_in_range_node() is in: setup_arch() |-->setup_real_mode() so, this patch add a function early_parse_srat() to parse SRAT, and call it before setup_real_mode() is called. NOTE: 1) early_parse_srat() is called before numa_init(), and has initialized numa_meminfo. So DO NOT clear numa_nodes_parsed in numa_init() and DO NOT zero numa_meminfo in numa_init(), otherwise we will lose memory numa info. 2) I don't know why using count of memory affinities parsed from SRAT as a return value in original acpi_numa_init(). So I add a static variable srat_mem_cnt to remember this count and use it as the return value of the new acpi_numa_init() [mhocko@suse.cz: parse SRAT before memblock is ready fix] Signed-off-by: Tang Chen <tangchen@cn.fujitsu.com> Reviewed-by: Wen Congyang <wency@cn.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: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com> Cc: Ingo Molnar <mingo@elte.hu> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: "H. Peter Anvin" <hpa@zytor.com> Cc: Len Brown <lenb@kernel.org> Cc: "Brown, Len" <len.brown@intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> |
||
---|---|---|
.. | ||
acpica | ||
apei | ||
ac.c | ||
acpi_i2c.c | ||
acpi_ipmi.c | ||
acpi_memhotplug.c | ||
acpi_pad.c | ||
acpi_platform.c | ||
battery.c | ||
bgrt.c | ||
blacklist.c | ||
bus.c | ||
button.c | ||
cm_sbs.c | ||
container.c | ||
csrt.c | ||
custom_method.c | ||
debugfs.c | ||
device_pm.c | ||
dock.c | ||
ec_sys.c | ||
ec.c | ||
event.c | ||
fan.c | ||
glue.c | ||
hed.c | ||
internal.h | ||
Kconfig | ||
Makefile | ||
numa.c | ||
nvs.c | ||
osl.c | ||
pci_irq.c | ||
pci_link.c | ||
pci_root.c | ||
pci_slot.c | ||
power.c | ||
proc.c | ||
processor_core.c | ||
processor_driver.c | ||
processor_idle.c | ||
processor_perflib.c | ||
processor_thermal.c | ||
processor_throttling.c | ||
reboot.c | ||
resource.c | ||
sbs.c | ||
sbshc.c | ||
sbshc.h | ||
scan.c | ||
sleep.c | ||
sleep.h | ||
sysfs.c | ||
tables.c | ||
thermal.c | ||
utils.c | ||
video_detect.c | ||
video.c | ||
wakeup.c |