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/sparse: remove sparse_decode_mem_map()

section_deactivate() applies to CONFIG_SPARSEMEM_VMEMMAP only. So we can
just use pfn_to_page() (after making sure we have the start PFN of the
section), and remove sparse_decode_mem_map().

Link: https://lkml.kernel.org/r/20260320-sparsemem_cleanups-v2-9-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
22688ade 7f8e592b

+1 -17
-2
include/linux/memory_hotplug.h
··· 308 308 struct dev_pagemap *pgmap); 309 309 extern void sparse_remove_section(unsigned long pfn, unsigned long nr_pages, 310 310 struct vmem_altmap *altmap); 311 - extern struct page *sparse_decode_mem_map(unsigned long coded_mem_map, 312 - unsigned long pnum); 313 311 extern struct zone *zone_for_pfn_range(enum mmop online_type, 314 312 int nid, struct memory_group *group, unsigned long start_pfn, 315 313 unsigned long nr_pages);
+1 -15
mm/sparse.c
··· 274 274 return coded_mem_map; 275 275 } 276 276 277 - #ifdef CONFIG_MEMORY_HOTPLUG 278 - /* 279 - * Decode mem_map from the coded memmap 280 - */ 281 - struct page *sparse_decode_mem_map(unsigned long coded_mem_map, unsigned long pnum) 282 - { 283 - /* mask off the extra low bits of information */ 284 - coded_mem_map &= SECTION_MAP_MASK; 285 - return ((struct page *)coded_mem_map) + section_nr_to_pfn(pnum); 286 - } 287 - #endif /* CONFIG_MEMORY_HOTPLUG */ 288 - 289 277 static void __meminit sparse_init_one_section(struct mem_section *ms, 290 278 unsigned long pnum, struct page *mem_map, 291 279 struct mem_section_usage *usage, unsigned long flags) ··· 742 754 743 755 empty = is_subsection_map_empty(ms); 744 756 if (empty) { 745 - unsigned long section_nr = pfn_to_section_nr(pfn); 746 - 747 757 /* 748 758 * Mark the section invalid so that valid_section() 749 759 * return false. This prevents code from dereferencing ··· 760 774 kfree_rcu(ms->usage, rcu); 761 775 WRITE_ONCE(ms->usage, NULL); 762 776 } 763 - memmap = sparse_decode_mem_map(ms->section_mem_map, section_nr); 777 + memmap = pfn_to_page(SECTION_ALIGN_DOWN(pfn)); 764 778 } 765 779 766 780 /*