Re: [PATCH mm-stable] mm/khugepaged: avoid unnecessary checking for swap entries when collapsing a mTHP
From: Kiryl Shutsemau
Date: Thu Aug 27 2026 - 10:08:30 EST
On Thu, Aug 27, 2026 at 08:11:51PM +0800, Lance Yang wrote:
> For the candidate above, the loop only reads its PTEs and returns
> SCAN_SUCCEED. Pedro's bitmap lets mthp_collapse() determine that upfront
> and skip the walk.
>
> Emm ... as I asked before[1], any numbers showing how much the extra scan
> costs?
With the win being only some scan cost, I don't think it is going to be
measurable.
It can open a path to future work. For example, we could find fully
populated mTHP windows in a PMD that is not eligible for collapse
because unmapped > max_ptes_swap. Right now we just give up on the whole
PMD in such cases.
But there are more wins to gain there. Just saying :P
--
Kiryl Shutsemau / Kirill A. Shutemov