[PATCH v3 2/3] mm/memblock: Expose total reserved memory

Srikar Dronamraju srikar at linux.vnet.ibm.com
Mon Aug 29 23:06:49 AEST 2016


The total reserved memory in a system is accounted but not available for
use use outside mm/memblock.c. By exposing the total reserved memory,
systems can better calculate the size of large hashes.

Cc: linux-mm at kvack.org
Cc: Mel Gorman <mgorman at techsingularity.net>
Cc: Vlastimil Babka <vbabka at suse.cz>
Cc: Michal Hocko <mhocko at kernel.org>
Cc: Andrew Morton <akpm at linux-foundation.org>
Cc: Michael Ellerman <mpe at ellerman.id.au>
Cc: linuxppc-dev at lists.ozlabs.org
Cc: Mahesh Salgaonkar <mahesh at linux.vnet.ibm.com>
Cc: Hari Bathini <hbathini at linux.vnet.ibm.com>
Cc: Dave Hansen <dave.hansen at intel.com>
Cc: Balbir Singh <bsingharora at gmail.com>
Suggested-by: Michael Ellerman <mpe at ellerman.id.au>
Signed-off-by: Srikar Dronamraju <srikar at linux.vnet.ibm.com>
---
 include/linux/memblock.h | 1 +
 mm/memblock.c            | 5 +++++
 2 files changed, 6 insertions(+)

diff --git a/include/linux/memblock.h b/include/linux/memblock.h
index 2925da2..5b759c9 100644
--- a/include/linux/memblock.h
+++ b/include/linux/memblock.h
@@ -328,6 +328,7 @@ phys_addr_t memblock_alloc_base(phys_addr_t size, phys_addr_t align,
 phys_addr_t __memblock_alloc_base(phys_addr_t size, phys_addr_t align,
 				  phys_addr_t max_addr);
 phys_addr_t memblock_phys_mem_size(void);
+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);
diff --git a/mm/memblock.c b/mm/memblock.c
index 483197e..c8dfa43 100644
--- a/mm/memblock.c
+++ b/mm/memblock.c
@@ -1438,6 +1438,11 @@ phys_addr_t __init_memblock memblock_phys_mem_size(void)
 	return memblock.memory.total_size;
 }
 
+phys_addr_t __init_memblock memblock_reserved_size(void)
+{
+	return memblock.reserved.total_size;
+}
+
 phys_addr_t __init memblock_mem_size(unsigned long limit_pfn)
 {
 	unsigned long pages = 0;
-- 
1.8.5.6



More information about the Linuxppc-dev mailing list