summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Hildenbrand (Arm) <david@kernel.org>2026-03-20 23:13:37 +0100
committerAndrew Morton <akpm@linux-foundation.org>2026-04-05 13:53:31 -0700
commit62257a5fb987cc6d092850ce6b70ec95a79a9442 (patch)
tree789f34d5e1428e4d2e21d45ffd979ae3432ab13a
parentfb3c3f5d27ef7c8845e3d0ac43c692216077602c (diff)
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>
-rw-r--r--mm/memory_hotplug.c20
1 files changed, 6 insertions, 14 deletions
diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
index 504aa50e3c33..8b18ddd1e7d5 100644
--- a/mm/memory_hotplug.c
+++ b/mm/memory_hotplug.c
@@ -319,21 +319,13 @@ static void release_memory_resource(struct resource *res)
static int check_pfn_span(unsigned long pfn, unsigned long nr_pages)
{
/*
- * Disallow all operations smaller than a sub-section and only
- * allow operations smaller than a section for
- * SPARSEMEM_VMEMMAP. Note that check_hotplug_memory_range()
- * enforces a larger memory_block_size_bytes() granularity for
- * memory that will be marked online, so this check should only
- * fire for direct arch_{add,remove}_memory() users outside of
- * add_memory_resource().
+ * Disallow all operations smaller than a sub-section.
+ * Note that check_hotplug_memory_range() enforces a larger
+ * memory_block_size_bytes() granularity for memory that will be marked
+ * online, so this check should only fire for direct
+ * arch_{add,remove}_memory() users outside of add_memory_resource().
*/
- unsigned long min_align;
-
- if (IS_ENABLED(CONFIG_SPARSEMEM_VMEMMAP))
- min_align = PAGES_PER_SUBSECTION;
- else
- min_align = PAGES_PER_SECTION;
- if (!IS_ALIGNED(pfn | nr_pages, min_align))
+ if (!IS_ALIGNED(pfn | nr_pages, PAGES_PER_SUBSECTION))
return -EINVAL;
return 0;
}