mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-14 07:44:21 +08:00
x86/numa: use get_pfn_range_for_nid to verify that node spans memory
Instead of looping over numa_meminfo array to detect node's start and end addresses use get_pfn_range_for_init(). This is shorter and make it easier to lift numa_memblks to generic code. Link: https://lkml.kernel.org/r/20240807064110.1003856-12-rppt@kernel.org Signed-off-by: Mike Rapoport (Microsoft) <rppt@kernel.org> Tested-by: Zi Yan <ziy@nvidia.com> # for x86_64 and arm64 Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Tested-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> [arm64 + CXL via QEMU] Acked-by: Dan Williams <dan.j.williams@intel.com> Acked-by: David Hildenbrand <david@redhat.com> Cc: Alexander Gordeev <agordeev@linux.ibm.com> Cc: Andreas Larsson <andreas@gaisler.com> Cc: Arnd Bergmann <arnd@arndb.de> Cc: Borislav Petkov <bp@alien8.de> Cc: Catalin Marinas <catalin.marinas@arm.com> Cc: Christophe Leroy <christophe.leroy@csgroup.eu> Cc: Dave Hansen <dave.hansen@linux.intel.com> Cc: Davidlohr Bueso <dave@stgolabs.net> Cc: David S. Miller <davem@davemloft.net> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: Heiko Carstens <hca@linux.ibm.com> Cc: Huacai Chen <chenhuacai@kernel.org> Cc: Ingo Molnar <mingo@redhat.com> Cc: Jiaxun Yang <jiaxun.yang@flygoat.com> Cc: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de> Cc: Jonathan Corbet <corbet@lwn.net> Cc: Michael Ellerman <mpe@ellerman.id.au> Cc: Palmer Dabbelt <palmer@dabbelt.com> Cc: Rafael J. Wysocki <rafael@kernel.org> Cc: Rob Herring (Arm) <robh@kernel.org> Cc: Samuel Holland <samuel.holland@sifive.com> Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Vasily Gorbik <gor@linux.ibm.com> Cc: Will Deacon <will@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
This commit is contained in:
parent
9916c27d1f
commit
77c1d0e7c5
@ -521,17 +521,14 @@ static int __init numa_register_memblks(struct numa_meminfo *mi)
|
||||
|
||||
/* Finally register nodes. */
|
||||
for_each_node_mask(nid, node_possible_map) {
|
||||
u64 start = PFN_PHYS(max_pfn);
|
||||
u64 end = 0;
|
||||
unsigned long start_pfn, end_pfn;
|
||||
|
||||
for (i = 0; i < mi->nr_blks; i++) {
|
||||
if (nid != mi->blk[i].nid)
|
||||
continue;
|
||||
start = min(mi->blk[i].start, start);
|
||||
end = max(mi->blk[i].end, end);
|
||||
}
|
||||
|
||||
if (start >= end)
|
||||
/*
|
||||
* Note, get_pfn_range_for_nid() depends on
|
||||
* memblock_set_node() having already happened
|
||||
*/
|
||||
get_pfn_range_for_nid(nid, &start_pfn, &end_pfn);
|
||||
if (start_pfn >= end_pfn)
|
||||
continue;
|
||||
|
||||
alloc_node_data(nid);
|
||||
|
Loading…
Reference in New Issue
Block a user