On Fri, 2019-07-12 at 23:09 +0000, Wei Yang wrote: > On Fri, Jul 12, 2019 at 10:51:31AM +0200, KarimAllah Ahmed wrote: > > > > Do not mark regions that are marked with nomap to be present, otherwise > > these memblock cause unnecessarily allocation of metadata. > > > > Cc: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> > > Cc: Pavel Tatashin <pasha.tatashin@xxxxxxxxxx> > > Cc: Oscar Salvador <osalvador@xxxxxxx> > > Cc: Michal Hocko <mhocko@xxxxxxxx> > > Cc: Mike Rapoport <rppt@xxxxxxxxxxxxx> > > Cc: Baoquan He <bhe@xxxxxxxxxx> > > Cc: Qian Cai <cai@xxxxxx> > > Cc: Wei Yang <richard.weiyang@xxxxxxxxx> > > Cc: Logan Gunthorpe <logang@xxxxxxxxxxxx> > > Cc: linux-mm@xxxxxxxxx > > Cc: linux-kernel@xxxxxxxxxxxxxxx > > Signed-off-by: KarimAllah Ahmed <karahmed@xxxxxxxxx> > > --- > > mm/sparse.c | 4 ++++ > > 1 file changed, 4 insertions(+) > > > > diff --git a/mm/sparse.c b/mm/sparse.c > > index fd13166..33810b6 100644 > > --- a/mm/sparse.c > > +++ b/mm/sparse.c > > @@ -256,6 +256,10 @@ void __init memblocks_present(void) > > struct memblock_region *reg; > > > > for_each_memblock(memory, reg) { > > + > > + if (memblock_is_nomap(reg)) > > + continue; > > + > > memory_present(memblock_get_region_node(reg), > > memblock_region_memory_base_pfn(reg), > > memblock_region_memory_end_pfn(reg)); > > > The logic looks good, while I am not sure this would take effect. Since the > metadata is SECTION size aligned while memblock is not. > > If I am correct, on arm64, we mark nomap memblock in map_mem() > > memblock_mark_nomap(kernel_start, kernel_end - kernel_start); The nomap is also done by EFI code in ${src}/drivers/firmware/efi/arm-init.c .. and hopefully in the future by this: https://lkml.org/lkml/2019/7/12/126 So it is not really striclty associated with the map_mem(). So it is extremely dependent on the platform how much memory will end up mapped as nomap. > > And kernel text area is less than 40M, if I am right. This means > memblocks_present would still mark the section present. > > Would you mind showing how much memory range it is marked nomap? We actually have some downstream patches that are using this nomap flag for more than the use-cases I described above which would enflate the nomap regions a bit :) > > > > > -- > > 2.7.4 > Amazon Development Center Germany GmbH Krausenstr. 38 10117 Berlin Geschaeftsfuehrung: Christian Schlaeger, Ralf Herbrich Eingetragen am Amtsgericht Charlottenburg unter HRB 149173 B Sitz: Berlin Ust-ID: DE 289 237 879