Re: [PATCH v12 mm-new 06/15] khugepaged: introduce collapse_max_ptes_none helper function

David Hildenbrand
2025-10-28T17:56:17Z

[...]

>
>> towards David's earlier simplified approach:
>> max_ptes_none == 511 -> collapse mTHP always
>> max_ptes_none != 511 -> collapse mTHP only if all PTEs are non-none/zero
>
> Pretty sure David's suggestion was that max_ptes_none would literally get set to
> 511 if you specified 511, or 0 if you specified anything else.

We had multiple incarnations of this approach, but the first one really was:

max_ptes_none == 511 -> collapse mTHP always
max_ptes_none == 0 -> collapse mTHP only if all non-none/zero

And for the intermediate values

(1) pr_warn() when mTHPs are enabled, stating that mTHP collapse is not
supported yet with other values
(2) treat it like max_ptes_none == 0 or (maybe better?) just disable
mTHP collapse

I still like that approach because it let's us defer solving the creep
problem later and doesn't add a silent capping.

Using intermediate max_ptes_none values are really only reasonable with
the deferred shrinker today. And that one does not support mTHP even
with this series, so it's future work either way.

--
Cheers

David / dhildenb