+ memblock-mem_hotplug-make-memblock-skip-hotpluggable-regions-if-needed.patch added to -mm tree
[email protected]
maintainerSubject: + memblock-mem_hotplug-make-memblock-skip-hotpluggable-regions-if-needed.patch added to -mm tree
To: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected]
From: [email protected]
Date: Tue, 03 Dec 2013 15:54:47 -0800
The patch titled
Subject: memblock, mem_hotplug: make memblock skip hotpluggable regions if needed
has been added to the -mm tree. Its filename is
memblock-mem_hotplug-make-memblock-skip-hotpluggable-regions-if-needed.patch
This patch should soon appear at
http://ozlabs.org/~akpm/mmots/broken-out/memblock-mem_hotplug-make-memblock-skip-hotpluggable-regions-if-needed.patch
and later at
http://ozlabs.org/~akpm/mmotm/broken-out/memblock-mem_hotplug-make-memblock-skip-hotpluggable-regions-if-needed.patch
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/SubmitChecklist when testing your code ***
The -mm tree is included into linux-next and is updated there every 3-4 working days
------------------------------------------------------
From: Tang Chen <[email protected]>
Subject: memblock, mem_hotplug: make memblock skip hotpluggable regions if needed
Linux kernel cannot migrate pages used by the kernel. As a result, hotpluggable memory used by the kernel won't be able to be hot-removed. To solve this problem, the basic idea is to prevent memblock from allocating hotpluggable memory for the kernel at early time, and arrange all hotpluggable memory in ACPI SRAT(System Resource Affinity Table) as ZONE_MOVABLE when initializing zones.
In the previous patches, we have marked hotpluggable memory regions with MEMBLOCK_HOTPLUG flag in memblock.memory.
In this patch, we make memblock skip these hotpluggable memory regions in the default top-down allocation function if movable_node boot option is specified.
---
include/linux/memblock.h | 18 ++++++++++++++++++ mm/memblock.c | 12 ++++++++++++ mm/memory_hotplug.c | 1 + 3 files changed, 31 insertions(+)
include/linux/memblock.h renamed from include/linux/memblock.h~memblock-mem_hotplug-make-memblock-skip-hotpluggable-regions-if-needed +18 -0
@@ -47,6 +47,10 @@ struct memblock {extern struct memblock memblock;extern int memblock_debug; +#ifdef CONFIG_MOVABLE_NODE +/* If movable_node boot option specified */ +extern bool movable_node_enabled; +#endif /* CONFIG_MOVABLE_NODE */ #define memblock_dbg (fmt, ...) \ if (memblock_debug) printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
@@ -65,6 +69,20 @@ int memblock_reserve(phys_addr_t base, pvoid memblock_trim_memory (phys_addr_t align);int memblock_mark_hotplug (phys_addr_t base,phys_addr_t size);int memblock_clear_hotplug (phys_addr_t base,phys_addr_t size); +#ifdef CONFIG_MOVABLE_NODE +static inline bool memblock_is_hotpluggable (struct memblock_region *m) +{ +return m->flags &MEMBLOCK_HOTPLUG ; +} + +static inline bool movable_node_is_enabled (void ) +{ +return movable_node_enabled; +} +#else +static inline bool memblock_is_hotpluggable (struct memblock_region *m){return false; } +static inline bool movable_node_is_enabled (void ) {return false; } +#endif #ifdef CONFIG_HAVE_MEMBLOCK_NODE_MAP int memblock_search_pfn_nid(unsigned long pfn, unsigned long *start_pfn,
mm/memblock.c renamed from mm/memblock.c~memblock-mem_hotplug-make-memblock-skip-hotpluggable-regions-if-needed +12 -0
@@ -39,6 +39,9 @@ struct memblock memblock __initdata_memb }; int memblock_debug __initdata_memblock; +#ifdef CONFIG_MOVABLE_NODE +bool movable_node_enabled __initdata_memblock = false; +#endif static int memblock_can_resize __initdata_memblock; static int memblock_memory_in_slab __initdata_memblock = 0; static int memblock_reserved_in_slab __initdata_memblock = 0;
@@ -819,6 +822,11 @@ void __init_memblock __next_free_mem_ran* @out_nid: ptr to int for nid of the range, can be %NULL * * Reverse of __next_free_mem_range(). +* +* Linux kernel cannot migrate pages used by itself. Memory hotplug users won't +* be able to hot-remove hotpluggable memory used by the kernel. So this +* function skip hotpluggable regions if needed when allocating memory for the +* kernel. */ void __init_memblock __next_free_mem_range_rev(u64 *idx, int nid, phys_addr_t *out_start,
@@ -843,6 +851,10 @@ void __init_memblock __next_free_mem_ranif (nid !=MAX_NUMNODES && nid !=memblock_get_region_node (m))continue ; +/* skip hotpluggable memory regions if needed */ +if (movable_node_is_enabled () &&memblock_is_hotpluggable (m)) +continue ; +/* scan areas before each reservation for intersection */ for ( ; ri >=0 ; ri--) {struct memblock_region *r = &rsv->regions[ri];
mm/memory_hotplug.c renamed from mm/memory_hotplug.c~memblock-mem_hotplug-make-memblock-skip-hotpluggable-regions-if-needed +1 -0
@@ -1446,6 +1446,7 @@ static int __init cmdline_parse_movable_* the kernel away from hotpluggable memory. */ memblock_set_bottom_up (true); + movable_node_enabled = true;#else pr_warn ("movable_node option not supported\n" );#endif
_
Patches currently in -mm which might be from [email protected] are
x86-get-pg_data_ts-memory-from-other-node.patch memblock-numa-introduce-flags-field-into-memblock.patch memblock-mem_hotplug-introduce-memblock_hotplug-flag-to-mark-hotpluggable-regions.patch memblock-make-memblock_set_node-support-different-memblock_type.patch acpi-numa-mem_hotplug-mark-hotpluggable-memory-in-memblock.patch acpi-numa-mem_hotplug-mark-all-nodes-the-kernel-resides-un-hotpluggable.patch memblock-mem_hotplug-make-memblock-skip-hotpluggable-regions-if-needed.patch x86-numa-acpi-memory-hotplug-make-movable_node-have-higher-priority.patch