Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

mm/bootmem_info: avoid using sparse_decode_mem_map()

With SPARSEMEM_VMEMMAP, we can just do a pfn_to_page(). It is not super
clear whether the start_pfn is properly aligned ... so let's just make
sure it is properly aligned to the start of the section.

We will soon might try to remove the bootmem info completely, for now,
just keep it working as is.

Link: https://lkml.kernel.org/r/20260320-sparsemem_cleanups-v2-8-096addc8800d@kernel.org
Signed-off-by: David Hildenbrand (Arm) <david@kernel.org>
Reviewed-by: Lorenzo Stoakes (Oracle) <ljs@kernel.org>
Reviewed-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
Cc: Axel Rasmussen <axelrasmussen@google.com>
Cc: Liam Howlett <liam.howlett@oracle.com>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Oscar Salvador <osalvador@suse.de>
Cc: Sidhartha Kumar <sidhartha.kumar@oracle.com>
Cc: Suren Baghdasaryan <surenb@google.com>
Cc: Vlastimil Babka <vbabka@kernel.org>
Cc: Wei Xu <weixugc@google.com>
Cc: Yuanchu Xie <yuanchu@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

David Hildenbrand (Arm) and committed by
Andrew Morton
7f8e592b 41293414

+4 -5
+4 -5
mm/bootmem_info.c
··· 44 44 { 45 45 unsigned long mapsize, section_nr, i; 46 46 struct mem_section *ms; 47 - struct page *page, *memmap; 48 47 struct mem_section_usage *usage; 48 + struct page *page; 49 49 50 + start_pfn = SECTION_ALIGN_DOWN(start_pfn); 50 51 section_nr = pfn_to_section_nr(start_pfn); 51 52 ms = __nr_to_section(section_nr); 52 53 53 - memmap = sparse_decode_mem_map(ms->section_mem_map, section_nr); 54 - 55 54 if (!preinited_vmemmap_section(ms)) 56 - register_page_bootmem_memmap(section_nr, memmap, 57 - PAGES_PER_SECTION); 55 + register_page_bootmem_memmap(section_nr, pfn_to_page(start_pfn), 56 + PAGES_PER_SECTION); 58 57 59 58 usage = ms->usage; 60 59 page = virt_to_page(usage);