From: "Zi Yan" <ziy@nvidia.com>
To: "Johannes Weiner" <hannes@cmpxchg.org>,
"Vlastimil Babka (SUSE)" <vbabka@kernel.org>,
"Nimrod Oren" <noren@nvidia.com>,
"Andrew Morton" <akpm@linux-foundation.org>,
"David Hildenbrand" <david@kernel.org>,
"Lorenzo Stoakes" <ljs@kernel.org>
Cc: "Baolin Wang" <baolin.wang@linux.alibaba.com>,
"Liam R. Howlett" <liam@infradead.org>,
"Nico Pache" <nico.pache@linux.dev>,
"Ryan Roberts" <ryan.roberts@arm.com>,
"Dev Jain" <dev.jain@arm.com>, "Barry Song" <baohua@kernel.org>,
"Lance Yang" <lance.yang@linux.dev>,
"Usama Arif" <usama.arif@linux.dev>,
"Kiryl Shutsemau" <kas@kernel.org>,
"Mike Rapoport" <rppt@kernel.org>,
"Suren Baghdasaryan" <surenb@google.com>,
"Michal Hocko" <mhocko@suse.com>,
"Brendan Jackman" <brendan.jackman@linux.dev>,
"Johannes Weiner" <hannes@cmpxchg.org>,
"Hugh Dickins" <hughd@google.com>,
"Nirmoy Das" <nirmoyd@nvidia.com>,
"Dragos Tatulea" <dtatulea@nvidia.com>, <linux-mm@kvack.org>,
<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v3] mm: remove min_free_kbytes adjustment for THP
Date: Tue, 08 Sep 2026 08:24:38 -0400 [thread overview]
Message-ID: <DL9XL8T6UG93.1T1NSJMI8PISK@nvidia.com> (raw)
In-Reply-To: <d202dcc3-d7d7-4e98-a9a5-3137cfbfd041@kernel.org>
On Tue Sep 8, 2026 at 7:54 AM EDT, Vlastimil Babka (SUSE) wrote:
> On 9/1/26 21:01, Nimrod Oren wrote:
>> When THP is enabled, set_recommended_min_free_kbytes() may raise
>> min_free_kbytes using a heuristic that scales with pageblock_nr_pages.
>> Commit f000565adb77 ("thp: set recommended min free kbytes") added this
>> heuristic to help keep pageblocks free and reduce fragmentation for THP
>> allocations.
>>
>> The recommendation scales poorly with larger base page sizes. With the
>> default arm64 pageblock sizes, the contribution per eligible zone
>> before applying the existing cap of 5% of low memory is:
>>
>> 4 KiB pages: 2 MiB pageblock, 22 MiB per zone
>> 16 KiB pages: 32 MiB pageblock, 352 MiB per zone
>> 64 KiB pages: 512 MiB pageblock, 5.5 GiB per zone
>>
>> Even with that cap, min_free_kbytes can reach excessive levels.
>>
>> The automatic min_free_kbytes increase predates proactive compaction
>> and many subsequent changes to compaction. Given those changes,
>> increasing min_free_kbytes for THP by default is no longer clearly
>> justified.
>>
>> Remove set_recommended_min_free_kbytes() and all associated
>> recalculation paths. With this policy gone, min_free_kbytes is
>> controlled only by the page allocator's default calculation and the
>> vm.min_free_kbytes sysctl. Users who want additional headroom may set a
>> higher value via that sysctl.
>>
>> Link: https://lore.kernel.org/r/20260831075635.2244437-1-noren@nvidia.com/
>> Suggested-by: Michal Hocko <mhocko@suse.com>
>> Signed-off-by: Nimrod Oren <noren@nvidia.com>
>> ---
>> v3:
>> * Replace the 1 GiB cap with removal of the THP-driven min_free_kbytes
>> increase as suggested by Michal.
>> * Remove all associated recalculation paths.
>> * Make min_free_kbytes, user_min_free_kbytes,
>> calculate_min_free_kbytes(), and setup_per_zone_wmarks() static.
>> * Drop the now-unused declarations and khugepaged's page_alloc.h include.
>> * Drop the obsolete v2 documentation addition.
>>
>> v2:
>> * Use a named constant for the cap.
>> * Drop explicit linux/sizes.h include.
>> * Update min_free_kbytes documentation.
>> https://lore.kernel.org/r/20260831075635.2244437-1-noren@nvidia.com/
>>
>> v1:
>> * Cap the final recommendation at 1 GiB as suggested by Lorenzo.
>> https://lore.kernel.org/r/20260728202014.2517142-1-noren@nvidia.com/
>>
>> RFC v1:
>> https://lore.kernel.org/r/20260716173504.760369-1-noren@nvidia.com/
>> ---
>> include/linux/khugepaged.h | 5 ----
>> mm/huge_memory.c | 14 ---------
>> mm/internal.h | 8 -----
>> mm/khugepaged.c | 60 --------------------------------------
>> mm/page_alloc.c | 11 +++----
>> mm/page_alloc.h | 2 --
>> mm/shmem.c | 7 -----
>> 7 files changed, 4 insertions(+), 103 deletions(-)
>
> Given neither of the patchset versions achieved universal acceptance, could
> we try just disabling all the automatic (re)calculations of min_free_kbytes
> the first moment the sysctl gets adjusted from userspace?
Sounds good to me. Johannes, WDYT?
--
Best Regards,
Yan, Zi
next prev parent reply other threads:[~2026-09-08 12:24 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-01 19:01 Nimrod Oren
2026-09-01 19:12 ` Michal Hocko
2026-09-01 20:01 ` Zi Yan
2026-09-01 20:44 ` Johannes Weiner
2026-09-01 21:09 ` Zi Yan
2026-09-01 22:09 ` Johannes Weiner
2026-09-02 1:49 ` Zi Yan
2026-09-02 13:02 ` Lorenzo Stoakes (ARM)
2026-09-02 16:04 ` Johannes Weiner
2026-09-02 16:47 ` Usama Arif
2026-09-02 17:02 ` Zi Yan
2026-09-02 17:24 ` Usama Arif
2026-09-02 17:13 ` Lorenzo Stoakes (ARM)
2026-09-03 18:58 ` Zi Yan
2026-09-04 15:20 ` Johannes Weiner
2026-09-08 10:40 ` Barry Song
2026-09-02 12:07 ` Nirmoy Das
2026-09-02 13:46 ` Lorenzo Stoakes (ARM)
2026-09-02 16:23 ` Johannes Weiner
2026-09-02 17:00 ` Lorenzo Stoakes (ARM)
2026-09-02 18:37 ` Johannes Weiner
2026-09-03 15:46 ` Lorenzo Stoakes (ARM)
2026-09-04 15:43 ` Johannes Weiner
2026-09-04 16:46 ` Lorenzo Stoakes (ARM)
2026-09-03 12:52 ` Michal Hocko
2026-09-02 16:41 ` Usama Arif
2026-09-08 11:54 ` Vlastimil Babka (SUSE)
2026-09-08 12:24 ` Zi Yan [this message]
2026-09-08 19:30 ` Johannes Weiner
2026-09-09 8:11 ` Lorenzo Stoakes (ARM)
2026-09-09 10:38 ` David Laight
2026-09-09 11:18 ` Lorenzo Stoakes (ARM)
2026-09-09 12:27 ` David Laight
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=DL9XL8T6UG93.1T1NSJMI8PISK@nvidia.com \
--to=ziy@nvidia.com \
--cc=akpm@linux-foundation.org \
--cc=baohua@kernel.org \
--cc=baolin.wang@linux.alibaba.com \
--cc=brendan.jackman@linux.dev \
--cc=david@kernel.org \
--cc=dev.jain@arm.com \
--cc=dtatulea@nvidia.com \
--cc=hannes@cmpxchg.org \
--cc=hughd@google.com \
--cc=kas@kernel.org \
--cc=lance.yang@linux.dev \
--cc=liam@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=ljs@kernel.org \
--cc=mhocko@suse.com \
--cc=nico.pache@linux.dev \
--cc=nirmoyd@nvidia.com \
--cc=noren@nvidia.com \
--cc=rppt@kernel.org \
--cc=ryan.roberts@arm.com \
--cc=surenb@google.com \
--cc=usama.arif@linux.dev \
--cc=vbabka@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®