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

From
Lorenzo Stoakes <hidden>
Date
2025-10-29 18:59:15
Also in
linux-doc, linux-mm, lkml
Reply to
Nico Pache, 2025-10-29
On Tue, Oct 28, 2025 at 08:47:12PM -0600, Nico Pache wrote:
On Tue, Oct 28, 2025 at 1:00 PM Lorenzo Stoakes
quoted
Right, well I agree if we can make this 0/511 thing work, let's do that.
Ok, great, some consensus! I will go ahead with that solution.
:) awesome.
Just to make sure we are all on the same page,
I am still stabilising my understanding of the creep issue, see the thread
where David kindly + patiently goes in detail, I think I am at a
(pre-examining algorithm itself) broad understanding of this.
the max_ptes_none value will be treated as 0 for anything other than
PMD collapse, or in the case of 511. Or will the max_ptes_none only
work for mTHP collapse when it is 0.
511 implies always collapse zero/none, 0 implies never, as I understand it.
static unsigned int collapse_max_ptes_none(unsigned int order, bool full_scan)
{
unsigned int max_ptes_none;

/* ignore max_ptes_none limits */
if (full_scan)
return HPAGE_PMD_NR - 1;

if (order == HPAGE_PMD_ORDER)
return khugepaged_max_ptes_none;

if (khugepaged_max_ptes_none != HPAGE_PMD_NR - 1)
return 0;

return max_ptes_none >> (HPAGE_PMD_ORDER - order);
}

Here's the implementation for the first approach, looks like Baolin
was able to catch up and beat me to the other solution while I was
mulling over the thread lol
Broadly looks similar to Baolin's, I made some suggestions over there
though!
Cheers,
-- Nico
Thanks, Lorenzo
Thread (91 messages) 91 messages, 11 authors, last reply 2025-11-26
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help