diff options
author | Mike Rapoport <rppt@linux.ibm.com> | 2021-11-05 23:43:07 +0300 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2021-11-06 23:30:40 +0300 |
commit | 5787ea5bed7607cbee26da492e574f94975e4d76 (patch) | |
tree | 960288b8dbcb5d587a4def610bd6baf9a43509f0 /drivers/base/arch_numa.c | |
parent | 41d4613b378cc10c087d8af621ace891d96d0907 (diff) | |
download | linux-5787ea5bed7607cbee26da492e574f94975e4d76.tar.xz |
arch_numa: simplify numa_distance allocation
Patch series "memblock: cleanup memblock_free interface", v2.
This is the fix for memblock freeing APIs mismatch [1].
The first patch is a cleanup of numa_distance allocation in arch_numa
I've spotted during the conversion. The second patch is a fix for Xen
memory freeing on some of the error paths.
[1] https://lore.kernel.org/all/CAHk-=wj9k4LZTz+svCxLYs5Y1=+yKrbAUArH1+ghyG3OLd8VVg@mail.gmail.com
This patch (of 6):
Memory allocation of numa_distance uses memblock_phys_alloc_range()
without actual range limits, converts the returned physical address to
virtual and then only uses the virtual address for further
initialization.
Simplify this by replacing memblock_phys_alloc_range() with
memblock_alloc().
Link: https://lkml.kernel.org/r/20210930185031.18648-1-rppt@kernel.org
Link: https://lkml.kernel.org/r/20210930185031.18648-2-rppt@kernel.org
Signed-off-by: Mike Rapoport <rppt@linux.ibm.com>
Cc: Christophe Leroy <christophe.leroy@csgroup.eu>
Cc: Juergen Gross <jgross@suse.com>
Cc: Shahab Vahedi <Shahab.Vahedi@synopsys.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/base/arch_numa.c')
-rw-r--r-- | drivers/base/arch_numa.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/drivers/base/arch_numa.c b/drivers/base/arch_numa.c index 28222688ace7..a6491673dc1f 100644 --- a/drivers/base/arch_numa.c +++ b/drivers/base/arch_numa.c @@ -337,15 +337,13 @@ void __init numa_free_distance(void) static int __init numa_alloc_distance(void) { size_t size; - u64 phys; int i, j; size = nr_node_ids * nr_node_ids * sizeof(numa_distance[0]); - phys = memblock_phys_alloc_range(size, PAGE_SIZE, 0, PFN_PHYS(max_pfn)); - if (WARN_ON(!phys)) + numa_distance = memblock_alloc(size, PAGE_SIZE); + if (WARN_ON(!numa_distance)) return -ENOMEM; - numa_distance = __va(phys); numa_distance_cnt = nr_node_ids; /* fill with the default distances */ |