Commit 2df79e4d authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull memblock fix from Mike Rapoport:
 "Fix memblock_estimated_nr_free_pages() for soft-reserved memory

  The "soft-reserved" memory regions (EFI_MEMORY_SP) are added to the
  memblock.reserved, but not to the memblock.memory. It causes
  memblock_estimated_nr_free_pages() to return a value smaller value
  than expected, or if it underflows, an extremely large value.

  Calculate the number of estimated free pages using
  memblock_reserved_kern_size() instead of memblock_reserved_size() to
  fix the issue"

* tag 'fixes-2025-11-19' of git://git.kernel.org/pub/scm/linux/kernel/git/rppt/memblock:
  memblock: fix memblock_estimated_nr_free_pages() for soft-reserved memory
parents 8b690556 c42af83c
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -1826,7 +1826,8 @@ phys_addr_t __init_memblock memblock_reserved_kern_size(phys_addr_t limit, int n
 */
unsigned long __init memblock_estimated_nr_free_pages(void)
{
	return PHYS_PFN(memblock_phys_mem_size() - memblock_reserved_size());
	return PHYS_PFN(memblock_phys_mem_size() -
			memblock_reserved_kern_size(MEMBLOCK_ALLOC_ANYWHERE, NUMA_NO_NODE));
}

/* lowest address */