Skip to content

Commit 1864d47

Browse files
rpptgregkh
authored andcommitted
memblock: allow zero threshold in validate_numa_converage()
[ Upstream commit 9cdc642 ] Currently memblock validate_numa_converage() returns false negative when threshold set to zero. Make the check if the memory size with invalid node ID is greater than the threshold exclusive to fix that. Link: https://lore.kernel.org/all/[email protected]/ Signed-off-by: Mike Rapoport (Microsoft) <[email protected]> Signed-off-by: Sasha Levin <[email protected]>
1 parent 6fdc770 commit 1864d47

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

mm/memblock.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -738,7 +738,7 @@ int __init_memblock memblock_add(phys_addr_t base, phys_addr_t size)
738738
/**
739739
* memblock_validate_numa_coverage - check if amount of memory with
740740
* no node ID assigned is less than a threshold
741-
* @threshold_bytes: maximal number of pages that can have unassigned node
741+
* @threshold_bytes: maximal memory size that can have unassigned node
742742
* ID (in bytes).
743743
*
744744
* A buggy firmware may report memory that does not belong to any node.
@@ -758,7 +758,7 @@ bool __init_memblock memblock_validate_numa_coverage(unsigned long threshold_byt
758758
nr_pages += end_pfn - start_pfn;
759759
}
760760

761-
if ((nr_pages << PAGE_SHIFT) >= threshold_bytes) {
761+
if ((nr_pages << PAGE_SHIFT) > threshold_bytes) {
762762
mem_size_mb = memblock_phys_mem_size() >> 20;
763763
pr_err("NUMA: no nodes coverage for %luMB of %luMB RAM\n",
764764
(nr_pages << PAGE_SHIFT) >> 20, mem_size_mb);

0 commit comments

Comments
 (0)