ARM: mm: initialize pfn limits with find_limits()
PATCH 1/1 ARM: mm: initialize pfn limits with find_limits()
The max_low_pfn value must be set before sparse_init() is called to keep the early memblock allocations and frees balanced for kmemleak initialization when sparsemem is enabled.
This commit accomplishes that by replacing the local variables min, max_low, and max_high with the global limit variables min_low_pfn, max_low_pfn, and max_pfn respectively in bootmem_init(). The global variables are initialized directly by find_limits() and used in the remainder of the function.
--- arch/arm/mm/init.c | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-)
arch/arm/mm/init.c +4 -16
@@ -302,15 +302,12 @@ void __init arm_memblock_init(const struct machine_desc *mdesc)void __init bootmem_init (void ) { -unsigned long min, max_low, max_high; -memblock_allow_resize (); - max_low = max_high =0 ; -find_limits (&min, &max_low, &max_high); +find_limits (&min_low_pfn, &max_low_pfn, &max_pfn); -early_memtest ((phys_addr_t )min <<PAGE_SHIFT , - (phys_addr_t )max_low <<PAGE_SHIFT ); +early_memtest ((phys_addr_t )min_low_pfn <<PAGE_SHIFT , + (phys_addr_t )max_low_pfn <<PAGE_SHIFT );/* * Sparsemem tries to allocate bootmem in memory_present(),
@@ -328,16 +325,7 @@ void __init bootmem_init(void)* the sparse mem_map arrays initialized by sparse_init() * for memmap_init_zone(), otherwise all PFNs are invalid. */ -zone_sizes_init (min, max_low, max_high); - -/* -* This doesn't seem to be used by the Linux memory manager any -* more, but is used by ll_rw_block. If we can get rid of it, we -* also get rid of some of the stuff above as well. -*/ - min_low_pfn = min; - max_low_pfn = max_low; - max_pfn = max_high; +zone_sizes_init (min_low_pfn, max_low_pfn, max_pfn); }/*
Signature · 1 line
2.7.4
Quoted 48 lines · Doug Berger
The
max_low_pfnvalue must be set beforesparse_init()is called to keep the early memblock allocations and frees balanced for kmemleak initialization when sparsemem is enabled.This commit accomplishes that by replacing the local variables min,
max_low, andmax_highwith the global limit variablesmin_low_pfn,max_low_pfn, andmax_pfnrespectively inbootmem_init(). The global variables are initialized directly byfind_limits()and used in the remainder of the function.Fixes 9099daed9c69 ("mm: kmemleak: avoid using __va() on addresses that don't have a lowmem mapping")Signed-off-by Doug Berger <[email protected]>--- arch/arm/mm/init.c | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-)arch/arm/mm/init.c +3
-10@@ -302,15 +302,12 @@ void __init arm_memblock_init(const struct machine_desc *mdesc)void __init bootmem_init (void ) { -unsigned long min, max_low, max_high; -memblock_allow_resize (); - max_low = max_high =0 ; -find_limits (&min, &max_low, &max_high); +find_limits (&min_low_pfn, &max_low_pfn, &max_pfn); -early_memtest ((phys_addr_t )min <<PAGE_SHIFT , - (phys_addr_t )max_low <<PAGE_SHIFT ); +early_memtest ((phys_addr_t )min_low_pfn <<PAGE_SHIFT , + (phys_addr_t )max_low_pfn <<PAGE_SHIFT );/* * Sparsemem tries to allocate bootmem in memory_present(), @@ -328,16 +325,7 @@ void __init bootmem_init(void)* the sparse mem_map arrays initialized by sparse_init() * for memmap_init_zone(), otherwise all PFNs are invalid. */ -zone_sizes_init (min, max_low, max_high); - -/* -* This doesn't seem to be used by the Linux memory manager any
arch/arm/mm/init.c void __init bootmem_init(void) · line 331
Quoted 10 lines
arch/arm/mm/init.c +1
-6-* more, but is used by ll_rw_block. If we can get rid of it, we -* also get rid of some of the stuff above as well. -*/ - min_low_pfn = min; - max_low_pfn = max_low; - max_pfn = max_high; +zone_sizes_init (min_low_pfn, max_low_pfn, max_pfn); }/*
Any feedback on this patch?
Thanks,
Doug
Quoted 57 lines · Doug Berger
Quoted 56 lines · Doug Berger
The
max_low_pfnvalue must be set beforesparse_init()is called to keep the early memblock allocations and frees balanced for kmemleak initialization when sparsemem is enabled.This commit accomplishes that by replacing the local variables min,
max_low, andmax_highwith the global limit variablesmin_low_pfn,max_low_pfn, andmax_pfnrespectively inbootmem_init(). The global variables are initialized directly byfind_limits()and used in the remainder of the function.Fixes 9099daed9c69 ("mm: kmemleak: avoid using __va() on addresses that don't have a lowmem mapping")Signed-off-by Doug Berger <[email protected]>--- arch/arm/mm/init.c | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-)arch/arm/mm/init.c +4
-16@@ -302,15 +302,12 @@ void __init arm_memblock_init(const struct machine_desc *mdesc)void __init bootmem_init (void ) { -unsigned long min, max_low, max_high; -memblock_allow_resize (); - max_low = max_high =0 ; -find_limits (&min, &max_low, &max_high); +find_limits (&min_low_pfn, &max_low_pfn, &max_pfn); -early_memtest ((phys_addr_t )min <<PAGE_SHIFT , - (phys_addr_t )max_low <<PAGE_SHIFT ); +early_memtest ((phys_addr_t )min_low_pfn <<PAGE_SHIFT , + (phys_addr_t )max_low_pfn <<PAGE_SHIFT );/* * Sparsemem tries to allocate bootmem in memory_present(), @@ -328,16 +325,7 @@ void __init bootmem_init(void)* the sparse mem_map arrays initialized by sparse_init() * for memmap_init_zone(), otherwise all PFNs are invalid. */ -zone_sizes_init (min, max_low, max_high); - -/* -* This doesn't seem to be used by the Linux memory manager any -* more, but is used by ll_rw_block. If we can get rid of it, we -* also get rid of some of the stuff above as well. -*/ - min_low_pfn = min; - max_low_pfn = max_low; - max_pfn = max_high; +zone_sizes_init (min_low_pfn, max_low_pfn, max_pfn); }
Quoted 4 lines
arch/arm/mm/init.c void __init bootmem_init(void) · line 331
Quoted 2 lines
arch/arm/mm/init.c +0
-0/* Any feedback on this patch?
Mike, Catalin, does this looks sensible to you? If so, should this be thrown into Russell's patch tracking system?
Thanks
Signature · 1 line
Florian
Mike Rapoport
Acked-byQuoted 58 lines · Florian Fainelli
Quoted 57 lines · Doug Berger
Quoted 56 lines · Doug Berger
The
max_low_pfnvalue must be set beforesparse_init()is called to keep the early memblock allocations and frees balanced for kmemleak initialization when sparsemem is enabled.This commit accomplishes that by replacing the local variables min,
max_low, andmax_highwith the global limit variablesmin_low_pfn,max_low_pfn, andmax_pfnrespectively inbootmem_init(). The global variables are initialized directly byfind_limits()and used in the remainder of the function.Fixes 9099daed9c69 ("mm: kmemleak: avoid using __va() on addresses that don't have a lowmem mapping")Signed-off-by Doug Berger <[email protected]>--- arch/arm/mm/init.c | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-)arch/arm/mm/init.c +4
-16@@ -302,15 +302,12 @@ void __init arm_memblock_init(const struct machine_desc *mdesc)void __init bootmem_init (void ) { -unsigned long min, max_low, max_high; -memblock_allow_resize (); - max_low = max_high =0 ; -find_limits (&min, &max_low, &max_high); +find_limits (&min_low_pfn, &max_low_pfn, &max_pfn); -early_memtest ((phys_addr_t )min <<PAGE_SHIFT , - (phys_addr_t )max_low <<PAGE_SHIFT ); +early_memtest ((phys_addr_t )min_low_pfn <<PAGE_SHIFT , + (phys_addr_t )max_low_pfn <<PAGE_SHIFT );/* * Sparsemem tries to allocate bootmem in memory_present(), @@ -328,16 +325,7 @@ void __init bootmem_init(void)* the sparse mem_map arrays initialized by sparse_init() * for memmap_init_zone(), otherwise all PFNs are invalid. */ -zone_sizes_init (min, max_low, max_high); - -/* -* This doesn't seem to be used by the Linux memory manager any -* more, but is used by ll_rw_block. If we can get rid of it, we -* also get rid of some of the stuff above as well. -*/ - min_low_pfn = min; - max_low_pfn = max_low; - max_pfn = max_high; +zone_sizes_init (min_low_pfn, max_low_pfn, max_pfn); }
Quoted 7 lines
Quoted 4 lines
arch/arm/mm/init.c void __init bootmem_init(void) · line 331
Quoted 2 lines
arch/arm/mm/init.c +0
-0/* Any feedback on this patch?
Mike, Catalin, does this looks sensible to you? If so, should this be thrown into Russell's patch tracking system?
Makes perfect sense to me, so
Quoted 4 lines
Thanks
Signature · 1 line
Florian
Signature · 2 lines
Sincerely yours, Mike.