Re: [PATCH] mm: stop recalculating min_free_kbytes once set by userspace

From: Zi Yan

Date: Wed Oct 14 2026 - 16:35:23 EST


On 14 Oct 2026, at 10:08, Nimrod Oren wrote:

> min_free_kbytes is recalculated on memory hotplug and on THP sysfs
> writes. The new value comes from calculate_min_free_kbytes() or, while
> THP is enabled, from set_recommended_min_free_kbytes(). A value written
> to the vm.min_free_kbytes sysctl is replaced whenever the new value is
> higher, so a lower value does not stick. This matters most when THP is
> enabled on configurations with large pageblocks, where the new value
> can be excessive [1].
>
> Stop recalculating min_free_kbytes once a value has been written to the
> sysctl. Systems where the sysctl is never written keep the current
> behavior.
>
> Link: https://lore.kernel.org/r/20260716173504.760369-1-noren@xxxxxxxxxx/ [1]
> Suggested-by: Vlastimil Babka (SUSE) <vbabka@xxxxxxxxxx>
> Link: https://lore.kernel.org/r/d202dcc3-d7d7-4e98-a9a5-3137cfbfd041@xxxxxxxxxx/
> Signed-off-by: Nimrod Oren <noren@xxxxxxxxxx>
> ---
> Documentation/admin-guide/sysctl/vm.rst | 7 +++++++
> mm/khugepaged.c | 7 +------
> mm/page_alloc.c | 6 +-----
> 3 files changed, 9 insertions(+), 11 deletions(-)
>

Acked-by: Zi Yan <ziy@xxxxxxxxxx>

Best Regards,
Yan, Zi