Files
linux/mm
Akinobu Mita c42af83c59 memblock: fix memblock_estimated_nr_free_pages() for soft-reserved memory
memblock_estimated_nr_free_pages() returns the difference between the total
size of the "memory" memblock type and the "reserved" memblock type.

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

/proc/sys/kernel/threads-max is determined by the value of
memblock_estimated_nr_free_pages().  This issue was discovered on machines
with CXL memory because kernel.threads-max was either smaller than expected
or extremely large for the installed DRAM size.

This fixes the issue by replacing memblock_reserved_size() with
memblock_reserved_kern_size() that tells how much memory was
reserved from the actual RAM.

Suggested-by: Mike Rapoport <rppt@kernel.org>
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Link: https://patch.msgid.link/20251111010010.7800-1-akinobu.mita@gmail.com
Signed-off-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
2025-11-11 18:15:35 +02:00
..
2025-09-21 14:22:09 -07:00
2024-11-03 01:28:06 -05:00
2025-10-03 16:42:44 -07:00
2025-10-03 16:42:43 -07:00
2025-09-21 14:21:59 -07:00
2025-09-21 14:22:00 -07:00
2025-09-13 16:54:58 -07:00
2025-09-13 16:55:07 -07:00
2025-08-02 12:06:09 -07:00
2025-09-13 16:54:46 -07:00
2025-09-23 14:14:16 -07:00
2025-09-21 14:22:28 -07:00
2025-09-13 16:55:07 -07:00
2025-09-13 16:55:07 -07:00
2025-09-21 14:21:59 -07:00