summaryrefslogtreecommitdiffstats
path: root/mm
diff options
context:
space:
mode:
authorLogan Gunthorpe <logang@deltatee.com>2018-12-14 17:16:57 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2018-12-14 18:05:45 -0500
commit9def36e0fa9a0d9c5393c039db59f1f2d3a388b3 (patch)
tree5288794d13f07dba8f7a326b3b0ba49b7d832413 /mm
parentd1402fc708e4c355813e49df6d15bc3466ba5114 (diff)
mm/sparse: add common helper to mark all memblocks present
Presently the arches arm64, arm and sh have a function which loops through each memblock and calls memory present. riscv will require a similar function. Introduce a common memblocks_present() function that can be used by all the arches. Subsequent patches will cleanup the arches that make use of this. Link: http://lkml.kernel.org/r/20181107205433.3875-3-logang@deltatee.com Signed-off-by: Logan Gunthorpe <logang@deltatee.com> Acked-by: Andrew Morton <akpm@linux-foundation.org> Cc: Michal Hocko <mhocko@suse.com> Cc: Vlastimil Babka <vbabka@suse.cz> Cc: Oscar Salvador <osalvador@suse.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm')
-rw-r--r--mm/sparse.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/mm/sparse.c b/mm/sparse.c
index 33307fc05c4d..3abc8cc50201 100644
--- a/mm/sparse.c
+++ b/mm/sparse.c
@@ -240,6 +240,22 @@ void __init memory_present(int nid, unsigned long start, unsigned long end)
240} 240}
241 241
242/* 242/*
243 * Mark all memblocks as present using memory_present(). This is a
244 * convienence function that is useful for a number of arches
245 * to mark all of the systems memory as present during initialization.
246 */
247void __init memblocks_present(void)
248{
249 struct memblock_region *reg;
250
251 for_each_memblock(memory, reg) {
252 memory_present(memblock_get_region_node(reg),
253 memblock_region_memory_base_pfn(reg),
254 memblock_region_memory_end_pfn(reg));
255 }
256}
257
258/*
243 * Subtle, we encode the real pfn into the mem_map such that 259 * Subtle, we encode the real pfn into the mem_map such that
244 * the identity pfn - section_mem_map will return the actual 260 * the identity pfn - section_mem_map will return the actual
245 * physical page frame number. 261 * physical page frame number.