Loading arch/arm64/mm/init.c +14 −2 Original line number Diff line number Diff line Loading @@ -30,6 +30,7 @@ #include <linux/crash_dump.h> #include <linux/memory.h> #include <linux/libfdt.h> #include <linux/memblock.h> #include <asm/boot.h> #include <asm/fixmap.h> Loading Loading @@ -268,9 +269,10 @@ static void __init update_memory_limit(void) unsigned long node, mp; const char *p; unsigned long long ram_sz, sz; phys_addr_t end_addr, addr_aligned, offset; int ret; ram_sz = memblock_end_of_DRAM() - memblock_start_of_DRAM(); ram_sz = memblock_phys_mem_size(); node = of_get_flat_dt_subnode_by_name(dt_root, "mem-offline"); if (node == -FDT_ERR_NOTFOUND) { pr_err("mem-offine node not found in FDT\n"); Loading @@ -294,7 +296,17 @@ static void __init update_memory_limit(void) } sz = ram_sz - ((ram_sz * mp) / 100); memory_limit = (phys_addr_t)sz; memory_limit = ALIGN(memory_limit, MIN_MEMORY_BLOCK_SIZE); end_addr = memblock_max_addr(memory_limit); addr_aligned = ALIGN(end_addr, MIN_MEMORY_BLOCK_SIZE); offset = addr_aligned - end_addr; if (offset > MIN_MEMORY_BLOCK_SIZE / 2) { addr_aligned = ALIGN_DOWN(end_addr, MIN_MEMORY_BLOCK_SIZE); offset = end_addr - addr_aligned; memory_limit -= offset; } else { memory_limit += offset; } pr_notice("Memory limit set/overridden to %lldMB\n", memory_limit >> 20); Loading include/linux/memblock.h +1 −0 Original line number Diff line number Diff line Loading @@ -441,6 +441,7 @@ phys_addr_t memblock_reserved_size(void); phys_addr_t memblock_mem_size(unsigned long limit_pfn); phys_addr_t memblock_start_of_DRAM(void); phys_addr_t memblock_end_of_DRAM(void); phys_addr_t memblock_max_addr(phys_addr_t limit); void memblock_enforce_memory_limit(phys_addr_t memory_limit); void memblock_cap_memory_range(phys_addr_t base, phys_addr_t size); void memblock_mem_limit_remove_map(phys_addr_t limit); Loading mm/memblock.c +5 −0 Original line number Diff line number Diff line Loading @@ -1645,6 +1645,11 @@ static phys_addr_t __init_memblock __find_max_addr(phys_addr_t limit) return max_addr; } phys_addr_t __init_memblock memblock_max_addr(phys_addr_t limit) { return __find_max_addr(limit); } void __init memblock_enforce_memory_limit(phys_addr_t limit) { phys_addr_t max_addr = PHYS_ADDR_MAX; Loading Loading
arch/arm64/mm/init.c +14 −2 Original line number Diff line number Diff line Loading @@ -30,6 +30,7 @@ #include <linux/crash_dump.h> #include <linux/memory.h> #include <linux/libfdt.h> #include <linux/memblock.h> #include <asm/boot.h> #include <asm/fixmap.h> Loading Loading @@ -268,9 +269,10 @@ static void __init update_memory_limit(void) unsigned long node, mp; const char *p; unsigned long long ram_sz, sz; phys_addr_t end_addr, addr_aligned, offset; int ret; ram_sz = memblock_end_of_DRAM() - memblock_start_of_DRAM(); ram_sz = memblock_phys_mem_size(); node = of_get_flat_dt_subnode_by_name(dt_root, "mem-offline"); if (node == -FDT_ERR_NOTFOUND) { pr_err("mem-offine node not found in FDT\n"); Loading @@ -294,7 +296,17 @@ static void __init update_memory_limit(void) } sz = ram_sz - ((ram_sz * mp) / 100); memory_limit = (phys_addr_t)sz; memory_limit = ALIGN(memory_limit, MIN_MEMORY_BLOCK_SIZE); end_addr = memblock_max_addr(memory_limit); addr_aligned = ALIGN(end_addr, MIN_MEMORY_BLOCK_SIZE); offset = addr_aligned - end_addr; if (offset > MIN_MEMORY_BLOCK_SIZE / 2) { addr_aligned = ALIGN_DOWN(end_addr, MIN_MEMORY_BLOCK_SIZE); offset = end_addr - addr_aligned; memory_limit -= offset; } else { memory_limit += offset; } pr_notice("Memory limit set/overridden to %lldMB\n", memory_limit >> 20); Loading
include/linux/memblock.h +1 −0 Original line number Diff line number Diff line Loading @@ -441,6 +441,7 @@ phys_addr_t memblock_reserved_size(void); phys_addr_t memblock_mem_size(unsigned long limit_pfn); phys_addr_t memblock_start_of_DRAM(void); phys_addr_t memblock_end_of_DRAM(void); phys_addr_t memblock_max_addr(phys_addr_t limit); void memblock_enforce_memory_limit(phys_addr_t memory_limit); void memblock_cap_memory_range(phys_addr_t base, phys_addr_t size); void memblock_mem_limit_remove_map(phys_addr_t limit); Loading
mm/memblock.c +5 −0 Original line number Diff line number Diff line Loading @@ -1645,6 +1645,11 @@ static phys_addr_t __init_memblock __find_max_addr(phys_addr_t limit) return max_addr; } phys_addr_t __init_memblock memblock_max_addr(phys_addr_t limit) { return __find_max_addr(limit); } void __init memblock_enforce_memory_limit(phys_addr_t limit) { phys_addr_t max_addr = PHYS_ADDR_MAX; Loading