This is a note to let you know that I've just added the patch titled Revert "mm: memblock: replace dereferences of memblock_region.nid with API calls" to the 4.19-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: revert-mm-memblock-replace-dereferences-of-memblock_.patch and it can be found in the queue-4.19 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. commit 207c9a4023b4a7ea9fbf779e16d0bb9a74144828 Author: Sasha Levin <sashal@xxxxxxxxxx> Date: Thu Jun 27 15:54:39 2024 -0400 Revert "mm: memblock: replace dereferences of memblock_region.nid with API calls" This reverts commit e39b20462e8d11dd9c71da53e6d00884c60ab56d. Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx> diff --git a/arch/arm64/mm/numa.c b/arch/arm64/mm/numa.c index f2f4c056822a7..15eaf1e09d0ca 100644 --- a/arch/arm64/mm/numa.c +++ b/arch/arm64/mm/numa.c @@ -365,16 +365,13 @@ static int __init numa_register_nodes(void) struct memblock_region *mblk; /* Check that valid nid is set to memblks */ - for_each_memblock(memory, mblk) { - int mblk_nid = memblock_get_region_node(mblk); - - if (mblk_nid == NUMA_NO_NODE || mblk_nid >= MAX_NUMNODES) { + for_each_memblock(memory, mblk) + if (mblk->nid == NUMA_NO_NODE || mblk->nid >= MAX_NUMNODES) { pr_warn("Warning: invalid memblk node %d [mem %#010Lx-%#010Lx]\n", - mblk_nid, mblk->base, + mblk->nid, mblk->base, mblk->base + mblk->size - 1); return -EINVAL; } - } /* Finally register nodes. */ for_each_node_mask(nid, numa_nodes_parsed) { diff --git a/arch/x86/mm/numa.c b/arch/x86/mm/numa.c index 411ded8664a9e..a830d49341ecc 100644 --- a/arch/x86/mm/numa.c +++ b/arch/x86/mm/numa.c @@ -506,10 +506,8 @@ static void __init numa_clear_kernel_node_hotplug(void) * reserve specific pages for Sandy Bridge graphics. ] */ for_each_memblock(reserved, mb_region) { - int nid = memblock_get_region_node(mb_region); - - if (nid != MAX_NUMNODES) - node_set(nid, reserved_nodemask); + if (mb_region->nid != MAX_NUMNODES) + node_set(mb_region->nid, reserved_nodemask); } /* diff --git a/mm/memblock.c b/mm/memblock.c index 0510d6c7ad14c..4d471da3cc479 100644 --- a/mm/memblock.c +++ b/mm/memblock.c @@ -1147,15 +1147,13 @@ void __init_memblock __next_mem_pfn_range(int *idx, int nid, { struct memblock_type *type = &memblock.memory; struct memblock_region *r; - int r_nid; while (++*idx < type->cnt) { r = &type->regions[*idx]; - r_nid = memblock_get_region_node(r); if (PFN_UP(r->base) >= PFN_DOWN(r->base + r->size)) continue; - if (nid == MAX_NUMNODES || nid == r_nid) + if (nid == MAX_NUMNODES || nid == r->nid) break; } if (*idx >= type->cnt) { @@ -1168,7 +1166,7 @@ void __init_memblock __next_mem_pfn_range(int *idx, int nid, if (out_end_pfn) *out_end_pfn = PFN_DOWN(r->base + r->size); if (out_nid) - *out_nid = r_nid; + *out_nid = r->nid; } /** @@ -1716,7 +1714,7 @@ int __init_memblock memblock_search_pfn_nid(unsigned long pfn, *start_pfn = PFN_DOWN(type->regions[mid].base); *end_pfn = PFN_DOWN(type->regions[mid].base + type->regions[mid].size); - return memblock_get_region_node(&type->regions[mid]); + return type->regions[mid].nid; } #endif diff --git a/mm/page_alloc.c b/mm/page_alloc.c index b8cccd1a9965e..147b67d31431d 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -6743,7 +6743,7 @@ static void __init find_zone_movable_pfns_for_nodes(void) if (!memblock_is_hotpluggable(r)) continue; - nid = memblock_get_region_node(r); + nid = r->nid; usable_startpfn = PFN_DOWN(r->base); zone_movable_pfn[nid] = zone_movable_pfn[nid] ? @@ -6764,7 +6764,7 @@ static void __init find_zone_movable_pfns_for_nodes(void) if (memblock_is_mirror(r)) continue; - nid = memblock_get_region_node(r); + nid = r->nid; usable_startpfn = memblock_region_memory_base_pfn(r);