memory: add kernelcore_max_addr boot option
Subsystems (6)
PATCH 1/1 memory: add kernelcore_max_addr boot option
Current ZONE_MOVABLE (kernelcore=) setting policy with boot option doesn't meet our requirement. We need something like kernelcore_max_addr= boot option to limit the kernelcore upper address.
The memory with higher address will be migratable(movable) and they are easier to be offline(always ready to be offline when the system don't require so much memory).
All kernelcore_max_addr=, kernelcore= and movablecore= can be safely specified at the same time(or any 2 of them).
--- Documentation/kernel-parameters.txt | 9 +++++++++ mm/page_alloc.c | 27 ++++++++++++++++++++++++++- 2 files changed, 35 insertions(+), 1 deletions(-)
Documentation/kernel-parameters.txt +9 -0
@@ -1184,6 +1184,15 @@ bytes respectively. Such letter suffixes can also be entirely omitted. use the HighMem zone if it exists, and the Normal zone if it does not. + kernelcore_max_addr=nn[KMG] [KNL,X86,IA-64,PPC] This parameter + is the same effect as kernelcore parameter, except it + specifies the up physical address of memory range + usable by the kernel for non-movable allocations. + If both kernelcore and kernelcore_max_addr are + specified, this requested's priority is higher than + kernelcore's. + See the kernelcore parameter. + kgdbdbgp= [KGDB,HW] kgdb over EHCI usb debug port. Format: <Controller#>[,poll interval] The controller # is the number of the ehci usb debug
mm/page_alloc.c +26 -1
@@ -200,6 +200,7 @@ static unsigned long __meminitdata dma_reserve;#ifdef CONFIG_HAVE_MEMBLOCK_NODE_MAP static unsigned long __meminitdata arch_zone_lowest_possible_pfn[MAX_NR_ZONES ];static unsigned long __meminitdata arch_zone_highest_possible_pfn[MAX_NR_ZONES ]; +static unsigned long __initdata required_kernelcore_max_pfn;static unsigned long __initdata required_kernelcore;static unsigned long __initdata required_movablecore;static unsigned long __meminitdata zone_movable_pfn[MAX_NUMNODES ];
@@ -4568,6 +4569,7 @@ static void __init find_zone_movable_pfns_for_nodes(void) {int i, nid;unsigned long usable_startpfn; +unsigned long kernelcore_max_pfn;unsigned long kernelcore_node, kernelcore_remaining;/* save the state before borrow the nodemask */ nodemask_t saved_node_state = node_states[N_HIGH_MEMORY ];
@@ -4596,6 +4598,9 @@ static void __init find_zone_movable_pfns_for_nodes(void) required_kernelcore =max (required_kernelcore, corepages); } +if (required_kernelcore_max_pfn && !required_kernelcore) + required_kernelcore = totalpages; +/* If kernelcore was not specified, there is no ZONE_MOVABLE */ if (!required_kernelcore) goto out;
@@ -4604,6 +4609,12 @@ static void __init find_zone_movable_pfns_for_nodes(void)find_usable_zone_for_movable (); usable_startpfn = arch_zone_lowest_possible_pfn[movable_zone]; +if (required_kernelcore_max_pfn) + kernelcore_max_pfn = required_kernelcore_max_pfn; +else + kernelcore_max_pfn =ULONG_MAX >>PAGE_SHIFT ; + kernelcore_max_pfn =max (kernelcore_max_pfn, usable_startpfn); + restart:/* Spread kernelcore memory as evenly as possible throughout nodes */ kernelcore_node = required_kernelcore / usable_nodes;
@@ -4630,8 +4641,12 @@ restart:unsigned long size_pages; start_pfn =max (start_pfn, zone_movable_pfn[nid]); -if (start_pfn >= end_pfn) + end_pfn =min (kernelcore_max_pfn, end_pfn); +if (start_pfn >= end_pfn) { +if (!zone_movable_pfn[nid]) + zone_movable_pfn[nid] = start_pfn;continue ; + }/* Account for what is only usable for kernelcore */ if (start_pfn < usable_startpfn) {
@@ -4816,6 +4831,15 @@ static int __init cmdline_parse_core(char *p, unsigned long *core) }/* +* kernelcore_max_addr=addr sets the up physical address of memory range +* for use for allocations that cannot be reclaimed or migrated. +*/ +static int __init cmdline_parse_kernelcore_max_addr (char *p) +{ +return cmdline_parse_core (p, &required_kernelcore_max_pfn); +} + +/* * kernelcore=size sets the amount of memory for use for allocations that * cannot be reclaimed or migrated. */
@@ -4833,6 +4857,7 @@ static int __init cmdline_parse_movablecore(char *p)return cmdline_parse_core (p, &required_movablecore); } +early_param ("kernelcore_max_addr" , cmdline_parse_kernelcore_max_addr);early_param ("kernelcore" , cmdline_parse_kernelcore);early_param ("movablecore" , cmdline_parse_movablecore);
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Andrew Morton
maintainerQuoted 3 lines · On Fri, 11 May 2012 13:46:04 +0800 Lai Jiangshan <[email protected]> wrote:
Current
ZONE_MOVABLE(kernelcore=) setting policy with boot option doesn't meet our requirement. We need something like kernelcore_max_addr= boot option to limit the kernelcore upper address.
Why do you need this? Please fully describe the requirement/use case.
Quoted 6 lines
The memory with higher address will be migratable(movable) and they are easier to be offline(always ready to be offline when the system don't require so much memory).
All kernelcore_max_addr=, kernelcore= and movablecore= can be safely specified at the same time(or any 2 of them).
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Hi Andrew,
Quoted 8 lines · Andrew Morton
Quoted 3 lines · On Fri, 11 May 2012 13:46:04 +0800 Lai Jiangshan<[email protected]> wrote:
Current
ZONE_MOVABLE(kernelcore=) setting policy with boot option doesn't meet our requirement. We need something like kernelcore_max_addr= boot option to limit the kernelcore upper address.Why do you need this? Please fully describe the requirement/use case.
We want to create removable node for removing a system board which equip CPU and memory at runtime. To do this, all memory of a node on system board must be allocated as ZONE_MOVABLE. But current linux cannot do it.
So we create removable node by limiting the memory address of the kernelcore by the boot option.
Thanks,
Yasuaki Ishimatsu
Quoted 15 lines
Quoted 6 lines
The memory with higher address will be migratable(movable) and they are easier to be offline(always ready to be offline when the system don't require so much memory).
All kernelcore_max_addr=, kernelcore= and movablecore= can be safely specified at the same time(or any 2 of them).
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email:<a href=mailto:"[email protected]"> [email protected]</a>
Hi Lai,
Your patch does not consider allocated memory from memblock. Thus even if I set the kernelcore_max_addr boot option, movable node cannot be created.
I made sample patches that limited the memory from memblock.
[Patch 1/4] x86: get pg_data_t's memory from other node
[Patch 2/4] x86: use memblock_set_current_limit() to set memblock.current_limit [Patch 3/4] memblock: limit memory address from memblock
[Patch 4/4] memblock: compare current_limit with end variable at memblock_find_in_range_node()
System seems to be able to create movable node by applying these patches.
But there are two problems.
- When online memory of movable zone is under 512MB by offlining memory, system cannot create new process.
- When all memory of movable zone is offlined, "kernel BUG at
mm/slub.c:3587!" message is shown.
I have not understood the root cause of the problems.
Thanks,
Yasuaki Ishimatsu
Quoted 120 lines · Lai Jiangshan
Current
ZONE_MOVABLE(kernelcore=) setting policy with boot option doesn't meet our requirement. We need something like kernelcore_max_addr= boot option to limit the kernelcore upper address.The memory with higher address will be migratable(movable) and they are easier to be offline(always ready to be offline when the system don't require so much memory).
All kernelcore_max_addr=, kernelcore= and movablecore= can be safely specified at the same time(or any 2 of them).
Signed-off-by Lai Jiangshan<[email protected]>--- Documentation/kernel-parameters.txt | 9 +++++++++ mm/page_alloc.c | 27 ++++++++++++++++++++++++++- 2 files changed, 35 insertions(+), 1 deletions(-)Documentation/kernel-parameters.txt +9
-0@@ -1184,6 +1184,15 @@ bytes respectively. Such letter suffixes can also be entirely omitted. use the HighMem zone if it exists, and the Normal zone if it does not. + kernelcore_max_addr=nn[KMG] [KNL,X86,IA-64,PPC] This parameter + is the same effect as kernelcore parameter, except it + specifies the up physical address of memory range + usable by the kernel for non-movable allocations. + If both kernelcore and kernelcore_max_addr are + specified, this requested's priority is higher than + kernelcore's. + See the kernelcore parameter. + kgdbdbgp= [KGDB,HW] kgdb over EHCI usb debug port. Format:<Controller#>[,poll interval] The controller # is the number of the ehci usb debugmm/page_alloc.c +26
-2@@ -200,6 +200,7 @@ static unsigned long __meminitdata dma_reserve;#ifdef CONFIG_HAVE_MEMBLOCK_NODE_MAP static unsigned long __meminitdata arch_zone_lowest_possible_pfn[MAX_NR_ZONES ];static unsigned long __meminitdata arch_zone_highest_possible_pfn[MAX_NR_ZONES ]; +static unsigned long __initdata required_kernelcore_max_pfn;static unsigned long __initdata required_kernelcore;static unsigned long __initdata required_movablecore;static unsigned long __meminitdata zone_movable_pfn[MAX_NUMNODES ];@@ -4568,6 +4569,7 @@ static void __init find_zone_movable_pfns_for_nodes(void) {int i, nid;unsigned long usable_startpfn; +unsigned long kernelcore_max_pfn;unsigned long kernelcore_node, kernelcore_remaining;/* save the state before borrow the nodemask */ nodemask_t saved_node_state = node_states[N_HIGH_MEMORY ];@@ -4596,6 +4598,9 @@ static void __init find_zone_movable_pfns_for_nodes(void) required_kernelcore =max (required_kernelcore, corepages); } +if (required_kernelcore_max_pfn&& !required_kernelcore) + required_kernelcore = totalpages; +/* If kernelcore was not specified, there is no ZONE_MOVABLE */ if (!required_kernelcore) goto out;@@ -4604,6 +4609,12 @@ static void __init find_zone_movable_pfns_for_nodes(void)find_usable_zone_for_movable (); usable_startpfn = arch_zone_lowest_possible_pfn[movable_zone]; +if (required_kernelcore_max_pfn) + kernelcore_max_pfn = required_kernelcore_max_pfn; +else + kernelcore_max_pfn =ULONG_MAX >>PAGE_SHIFT ; + kernelcore_max_pfn =max (kernelcore_max_pfn, usable_startpfn); + restart:/* Spread kernelcore memory as evenly as possible throughout nodes */ kernelcore_node = required_kernelcore / usable_nodes;@@ -4630,8 +4641,12 @@ restart:unsigned long size_pages; start_pfn =max (start_pfn, zone_movable_pfn[nid]); -if (start_pfn>= end_pfn) + end_pfn =min (kernelcore_max_pfn, end_pfn); +if (start_pfn>= end_pfn) { +if (!zone_movable_pfn[nid]) + zone_movable_pfn[nid] = start_pfn;continue ; + }/* Account for what is only usable for kernelcore */ if (start_pfn< usable_startpfn) {@@ -4816,6 +4831,15 @@ static int __init cmdline_parse_core(char *p, unsigned long *core) }/* +* kernelcore_max_addr=addr sets the up physical address of memory range +* for use for allocations that cannot be reclaimed or migrated. +*/ +static int __init cmdline_parse_kernelcore_max_addr (char *p) +{ +return cmdline_parse_core (p,&required_kernelcore_max_pfn); +} + +/* * kernelcore=size sets the amount of memory for use for allocations that * cannot be reclaimed or migrated. */ @@ -4833,6 +4857,7 @@ static int __init cmdline_parse_movablecore(char *p)return cmdline_parse_core (p,&required_movablecore); } +early_param ("kernelcore_max_addr" , cmdline_parse_kernelcore_max_addr);early_param ("kernelcore" , cmdline_parse_kernelcore);early_param ("movablecore" , cmdline_parse_movablecore); --
Quoted 7 lines
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email:<a href=mailto:"[email protected]"> [email protected]</a>
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
PATCH 1/4 x86: get pg_data_t's memory from other node
If system can create movable node which all memory of the node is allocated as ZONE_MOVABLE, setup_node_data() cannot allocate memory for the node's pg_data_t.
So when memblock_alloc_nid() fails, setup_node_data() retries memblock_alloc().
--- arch/x86/mm/numa.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
arch/x86/mm/numa.c +6 -2
@@ -223,9 +223,13 @@ static void __init setup_node_data(int n remapped = true; }else { nd_pa =memblock_alloc_nid (nd_size,SMP_CACHE_BYTES , nid); -if (!nd_pa) { -pr_err ("Cannot find %zu bytes in node %d\n" , +if (!nd_pa) +printk (KERN_WARNING "Cannot find %zu bytes in node %d\n" , nd_size, nid); + nd_pa =memblock_alloc (nd_size,SMP_CACHE_BYTES ); +if (!nd_pa) { +pr_err ("Cannot find %zu bytes in other node\n" , + nd_size);return ; } nd =__va (nd_pa);
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
PATCH 2/4 x86: use memblock_set_current_limit() to set memblock.current_limit
In reply to Yasuaki Ishimatsumemblock.current_limit is set directly though memblock_set_current_limit() is prepared. So fix it.
--- arch/x86/kernel/setup.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/x86/kernel/setup.c +2 -2
@@ -897,7 +897,7 @@ void __init setup_arch(char **cmdline_p)cleanup_highmap (); - memblock.current_limit =get_max_mapped (); +memblock_set_current_limit (get_max_mapped ());memblock_x86_fill ();/*
@@ -933,7 +933,7 @@ void __init setup_arch(char **cmdline_p) max_low_pfn = max_pfn; }#endif - memblock.current_limit =get_max_mapped (); +memblock_set_current_limit (get_max_mapped ());/* * NOTE: On x86-32, only from this point on, fixmaps are ready for use.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
PATCH 3/4 memblock: limit memory address from memblock
In reply to Yasuaki IshimatsuSetting kernelcore_max_pfn means all memory which is bigger than the boot parameter is allocated as ZONE_MOVABLE. So memory which is allocated by memblock also should be limited by the parameter.
The patch limits memory from memblock.
--- include/linux/memblock.h | 1 + mm/memblock.c | 5 ++++- mm/page_alloc.c | 6 +++++- 3 files changed, 10 insertions(+), 2 deletions(-)
include/linux/memblock.h +1 -0
@@ -42,6 +42,7 @@ struct memblock {extern struct memblock memblock;extern int memblock_debug; +extern phys_addr_t memblock_limit;#define memblock_dbg (fmt, ...) \ if (memblock_debug) printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
mm/memblock.c +4 -1
@@ -876,7 +876,10 @@ int __init_memblock memblock_is_region_r void __init_memblock memblock_set_current_limit(phys_addr_t limit) { - memblock.current_limit = limit; +if (!memblock_limit || (memblock_limit > limit)) + memblock.current_limit = limit; +else + memblock.current_limit = memblock_limit; } static void __init_memblock memblock_dump(struct memblock_type *type, char *name)
mm/page_alloc.c +5 -1
@@ -205,6 +205,8 @@ static unsigned long __initdata requiredstatic unsigned long __initdata required_movablecore;static unsigned long __meminitdata zone_movable_pfn[MAX_NUMNODES ]; +phys_addr_t memblock_limit; +/* movable_zone is the "real" zone pages in ZONE_MOVABLE are taken from */ int movable_zone;EXPORT_SYMBOL (movable_zone);
@@ -4836,7 +4838,9 @@ static int __init cmdline_parse_core(cha*/ static int __init cmdline_parse_kernelcore_max_addr (char *p) { -return cmdline_parse_core (p, &required_kernelcore_max_pfn); +cmdline_parse_core (p, &required_kernelcore_max_pfn); + memblock_limit = required_kernelcore_max_pfn <<PAGE_SHIFT ; +return 0 ; }/*
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Re: [Patch 3/4] memblock: limit memory address from memblock
Quoted 5 lines · Yasuaki Ishimatsu
Setting
kernelcore_max_pfnmeans all memory which is bigger than the boot parameter is allocated asZONE_MOVABLE. So memory which is allocated by memblock also should be limited by the parameter.The patch limits memory from memblock.
I see no reason why we need two limits for memblock. And if we really require two limits then please use a function to set it.
All other setup/etc. towoards memblock is via function, and starting to introduce magic variables is confusing.
Also new stuff in memblock shal have a nice comment describing the usage. that we in the past has failed to do so is no excuse.
Sam
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
PATCH 4/4 memblock: compare current_limit with end variable at memblock_find_in_range_node()
In reply to Yasuaki Ishimatsumemblock_find_in_range_node() does not compare memblock.current_limit with end variable. Thus even if memblock.current_limit is smaller than end variable, the function allocates memory address that is bigger than memblock.current_limit.
The patch adds the check to "memblock_find_in_range_node()"
--- mm/memblock.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
mm/memblock.c +3 -2
@@ -97,11 +97,12 @@ phys_addr_t __init_memblock memblock_fin phys_addr_t align, int nid) {phys_addr_t this_start, this_end, cand; +phys_addr_t current_limit = memblock.current_limit;u64 i;/* pump up @end */ -if (end ==MEMBLOCK_ALLOC_ACCESSIBLE ) - end = memblock.current_limit; +if ((end ==MEMBLOCK_ALLOC_ACCESSIBLE ) || (end > current_limit)) + end = current_limit;/* avoid allocating the first page */ start =max_t (phys_addr_t, start,PAGE_SIZE );
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Hi Lai,
Quoted 17 lines · Yasuaki Ishimatsu
Hi Lai,
Your patch does not consider allocated memory from memblock. Thus even if I set the
kernelcore_max_addrboot option, movable node cannot be created.I made sample patches that limited the memory from memblock.
[Patch 1/4] x86: get pg_data_t's memory from other node
[Patch 2/4] x86: usememblock_set_current_limit()to set memblock.current_limit [Patch 3/4] memblock: limit memory address from memblock
[Patch 4/4] memblock: comparecurrent_limitwith end variable atmemblock_find_in_range_node()System seems to be able to create movable node by applying these patches.
Quoted 5 lines
But there are two problems.
- When online memory of movable zone is under 512MB by offlining memory, system cannot create new process.
- When all memory of movable zone is offlined, "kernel BUG atmm/slub.c:3587!" message is shown.
There are typos.
s/zone/node/
Thanks,
Yasuaki Ishimatsu
Quoted 125 lines
I have not understood the root cause of the problems.
Thanks,
Yasuaki IshimatsuQuoted 119 lines · Lai Jiangshan
Current
ZONE_MOVABLE(kernelcore=) setting policy with boot option doesn't meet our requirement. We need something like kernelcore_max_addr= boot option to limit the kernelcore upper address.The memory with higher address will be migratable(movable) and they are easier to be offline(always ready to be offline when the system don't require so much memory).
All kernelcore_max_addr=, kernelcore= and movablecore= can be safely specified at the same time(or any 2 of them).
Signed-off-by Lai Jiangshan<[email protected]>---
Documentation/kernel-parameters.txt| 9 +++++++++mm/page_alloc.c| 27 ++++++++++++++++++++++++++-2 files changed, 35 insertions(+), 1 deletions(-)Documentation/kernel-parameters.txt +0
-0@@ -1184,6 +1184,15 @@ bytes respectively. Such letter suffixes can also be entirely omitted.use the HighMem zone if it exists, and the Normal
zone if it does not.+ kernelcore_max_addr=nn[KMG] [KNL,X86,IA-64,PPC] This parameter
+ is the same effect as kernelcore parameter, except it
+ specifies the up physical address of memory range
+ usable by the kernel for non-movable allocations.
+ If both kernelcore andkernelcore_max_addrare
+ specified, this requested's priority is higher than
+ kernelcore's.
+ See the kernelcore parameter.
+
kgdbdbgp= [KGDB,HW] kgdb over EHCI usb debug port. Format:<Controller#>[,poll interval]
The controller # is the number of the ehci usb debugmm/page_alloc.c +11
-0@@ -200,6 +200,7 @@ static unsigned long __meminitdata dma_reserve;#ifdef CONFIG_HAVE_MEMBLOCK_NODE_MAP static unsigned long __meminitdata arch_zone_lowest_possible_pfn[MAX_NR_ZONES ];static unsigned long __meminitdata arch_zone_highest_possible_pfn[MAX_NR_ZONES ]; +static unsigned long __initdata required_kernelcore_max_pfn;static unsigned long __initdata required_kernelcore;static unsigned long __initdata required_movablecore;static unsigned long __meminitdata zone_movable_pfn[MAX_NUMNODES ];@@ -4568,6 +4569,7 @@ static void __init find_zone_movable_pfns_for_nodes(void) {int i, nid;unsigned long usable_startpfn; +unsigned long kernelcore_max_pfn;unsigned long kernelcore_node, kernelcore_remaining;/* save the state before borrow the nodemask */ nodemask_t saved_node_state = node_states[N_HIGH_MEMORY ];@@ -4596,6 +4598,9 @@ static void __init find_zone_movable_pfns_for_nodes(void) required_kernelcore =max (required_kernelcore, corepages); } +if (required_kernelcore_max_pfn&& !required_kernelcore) + required_kernelcore = totalpages; +/* If kernelcore was not specified, there is no ZONE_MOVABLE */ if (!required_kernelcore) goto out;@@ -4604,6 +4609,12 @@ static void __init find_zone_movable_pfns_for_nodes(void)find_usable_zone_for_movable (); usable_startpfn = arch_zone_lowest_possible_pfn[movable_zone]; +if (required_kernelcore_max_pfn) + kernelcore_max_pfn = required_kernelcore_max_pfn; +else + kernelcore_max_pfn =ULONG_MAX >>PAGE_SHIFT ; + kernelcore_max_pfn =max (kernelcore_max_pfn, usable_startpfn); +restart:
/* Spread kernelcore memory as evenly as possible throughout nodes */kernelcore_node=required_kernelcore/usable_nodes;mm/page_alloc.c +15
-1@@ -4630,8 +4641,12 @@ restart:unsigned long size_pages; start_pfn =max (start_pfn, zone_movable_pfn[nid]); -if (start_pfn>= end_pfn) + end_pfn =min (kernelcore_max_pfn, end_pfn); +if (start_pfn>= end_pfn) { +if (!zone_movable_pfn[nid]) + zone_movable_pfn[nid] = start_pfn;continue ; + }/* Account for what is only usable for kernelcore */ if (start_pfn< usable_startpfn) {@@ -4816,6 +4831,15 @@ static int __init cmdline_parse_core(char *p, unsigned long *core) }/* +* kernelcore_max_addr=addr sets the up physical address of memory range +* for use for allocations that cannot be reclaimed or migrated. +*/ +static int __init cmdline_parse_kernelcore_max_addr (char *p) +{ +return cmdline_parse_core (p,&required_kernelcore_max_pfn); +} + +/* * kernelcore=size sets the amount of memory for use for allocations that * cannot be reclaimed or migrated. */ @@ -4833,6 +4857,7 @@ static int __init cmdline_parse_movablecore(char *p)return cmdline_parse_core (p,&required_movablecore); } +early_param ("kernelcore_max_addr" , cmdline_parse_kernelcore_max_addr);early_param ("kernelcore" , cmdline_parse_kernelcore);early_param ("movablecore" , cmdline_parse_movablecore);
Quoted 18 lines
Quoted 8 lines
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email:<a href=mailto:"[email protected]"> [email protected]</a>--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>