summaryrefslogtreecommitdiffstats
path: root/mm
diff options
context:
space:
mode:
authorAlison Schofield <alison.schofield@intel.com>2024-01-12 12:09:50 -0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2024-03-01 13:41:54 +0100
commit6b725eab0967839ec393d8caa827cec2886c2aa5 (patch)
tree1d273cd837a4f289b64b7cc5809f92f2073a2b1b /mm
parentbf21b0b98a474f8d271aaddec3af0a084c4553d4 (diff)
downloadlinux-stable-6b725eab0967839ec393d8caa827cec2886c2aa5.tar.gz
linux-stable-6b725eab0967839ec393d8caa827cec2886c2aa5.tar.bz2
linux-stable-6b725eab0967839ec393d8caa827cec2886c2aa5.zip
x86/numa: Fix the address overlap check in numa_fill_memblks()
[ Upstream commit 9b99c17f7510bed2adbe17751fb8abddba5620bc ] numa_fill_memblks() fills in the gaps in numa_meminfo memblks over a physical address range. To do so, it first creates a list of existing memblks that overlap that address range. The issue is that it is off by one when comparing to the end of the address range, so memblks that do not overlap are selected. The impact of selecting a memblk that does not actually overlap is that an existing memblk may be filled when the expected action is to do nothing and return NUMA_NO_MEMBLK to the caller. The caller can then add a new NUMA node and memblk. Replace the broken open-coded search for address overlap with the memblock helper memblock_addrs_overlap(). Update the kernel doc and in code comments. Suggested by: "Huang, Ying" <ying.huang@intel.com> Fixes: 8f012db27c95 ("x86/numa: Introduce numa_fill_memblks()") Signed-off-by: Alison Schofield <alison.schofield@intel.com> Acked-by: Mike Rapoport (IBM) <rppt@kernel.org> Acked-by: Dave Hansen <dave.hansen@linux.intel.com> Reviewed-by: Dan Williams <dan.j.williams@intel.com> Link: https://lore.kernel.org/r/10a3e6109c34c21a8dd4c513cf63df63481a2b07.1705085543.git.alison.schofield@intel.com Signed-off-by: Dan Williams <dan.j.williams@intel.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'mm')
-rw-r--r--mm/memblock.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/mm/memblock.c b/mm/memblock.c
index 1572956c5e31..9a5248fe9cf9 100644
--- a/mm/memblock.c
+++ b/mm/memblock.c
@@ -180,8 +180,9 @@ static inline phys_addr_t memblock_cap_size(phys_addr_t base, phys_addr_t *size)
/*
* Address comparison utilities
*/
-static unsigned long __init_memblock memblock_addrs_overlap(phys_addr_t base1, phys_addr_t size1,
- phys_addr_t base2, phys_addr_t size2)
+unsigned long __init_memblock
+memblock_addrs_overlap(phys_addr_t base1, phys_addr_t size1, phys_addr_t base2,
+ phys_addr_t size2)
{
return ((base1 < (base2 + size2)) && (base2 < (base1 + size1)));
}