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/memory_hotplug: simplify check_pfn_span()

We now always have CONFIG_SPARSEMEM_VMEMMAP, so remove the dead code.

Link: https://lkml.kernel.org/r/20260320-sparsemem_cleanups-v2-5-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
62257a5f fb3c3f5d

+6 -14
+6 -14
mm/memory_hotplug.c
··· 319 319 static int check_pfn_span(unsigned long pfn, unsigned long nr_pages) 320 320 { 321 321 /* 322 - * Disallow all operations smaller than a sub-section and only 323 - * allow operations smaller than a section for 324 - * SPARSEMEM_VMEMMAP. Note that check_hotplug_memory_range() 325 - * enforces a larger memory_block_size_bytes() granularity for 326 - * memory that will be marked online, so this check should only 327 - * fire for direct arch_{add,remove}_memory() users outside of 328 - * add_memory_resource(). 322 + * Disallow all operations smaller than a sub-section. 323 + * Note that check_hotplug_memory_range() enforces a larger 324 + * memory_block_size_bytes() granularity for memory that will be marked 325 + * online, so this check should only fire for direct 326 + * arch_{add,remove}_memory() users outside of add_memory_resource(). 329 327 */ 330 - unsigned long min_align; 331 - 332 - if (IS_ENABLED(CONFIG_SPARSEMEM_VMEMMAP)) 333 - min_align = PAGES_PER_SUBSECTION; 334 - else 335 - min_align = PAGES_PER_SECTION; 336 - if (!IS_ALIGNED(pfn | nr_pages, min_align)) 328 + if (!IS_ALIGNED(pfn | nr_pages, PAGES_PER_SUBSECTION)) 337 329 return -EINVAL; 338 330 return 0; 339 331 }