Skip to contentSkip to conversation

mm-sparse-remove-unnecessary-null-check-before-allocating-mem_section.patch removed from -mm tree

merged mm-stable Andrew Morton 1 participant 1 message May 29

lore
Share & tools
lore

Andrew Morton

author tree notice Applied
#0 lore raw

The quilt patch titled
Subject: mm/sparse: remove unnecessary NULL check before allocating mem_section
has been removed from the -mm tree. Its filename was
mm-sparse-remove-unnecessary-null-check-before-allocating-mem_section.patch

This patch was dropped because it was merged into the mm-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

------------------------------------------------------
From: Sang-Heon Jeon <[email protected]>
Subject: mm/sparse: remove unnecessary NULL check before allocating mem_section
Date: Sun, 19 Apr 2026 23:42:25 +0900

Commit 850ed20539a4 ("mm: move array mem_section init code out of memory_present()") moved mem_section allocation logic into memblocks_present().

Before that move, memory_present() could be called multiple times, so unlikely() matched the common case, where most calls found mem_section already allocated.

After that move, memblocks_present() is called exactly once from sparse_init(). Under CONFIG_SPARSEMEM_EXTREME, mem_section is always NULL when it is called.

So remove unnecessary NULL check before allocating mem_section. No functional change.

Reviewed by: Donet Tom <[email protected]>

Cc Liam Howlett <[email protected]>
Cc Lorenzo Stoakes <[email protected]>
Cc Michal Hocko <[email protected]>
Cc Suren Baghdasaryan <[email protected]>

---

 mm/sparse.c |   10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)
mm/sparse.c renamed from mm/sparse.c~mm-sparse-remove-unnecessary-null-check-before-allocating-mem_section +4 -6
@@ -201,13 +201,11 @@ static void __init memblocks_present(voi
 	int i, nid;
 
 #ifdef CONFIG_SPARSEMEM_EXTREME
-	if (unlikely(!mem_section)) {
-		unsigned long size, align;
+	unsigned long size, align;
 
-		size = sizeof(struct mem_section *) * NR_SECTION_ROOTS;
-		align = 1 << (INTERNODE_CACHE_SHIFT);
-		mem_section = memblock_alloc_or_panic(size, align);
-	}
+	size = sizeof(struct mem_section *) * NR_SECTION_ROOTS;
+	align = 1 << (INTERNODE_CACHE_SHIFT);
+	mem_section = memblock_alloc_or_panic(size, align);
 #endif
 
 	for_each_mem_pfn_range(i, MAX_NUMNODES, &start, &end, &nid)

_

Patches currently in -mm which might be from [email protected] are

mm-hugetlb_cma-restrict-hugetlb_cma-parameter-to-gigantic-page-alignment.patch