Re: [RESEND RFC PATCH v2 2/5] mm/khugepaged: add damon_collapse_folio_range() for external callers
From: SJ Park
Date: Thu Jul 02 2026 - 16:37:11 EST
On Thu, 02 Jul 2026 12:43:59 -0700 SJ Park <sj@xxxxxxxxxx> wrote:
> On Thu, 2 Jul 2026 12:07:01 +0100 Lorenzo Stoakes <ljs@xxxxxxxxxx> wrote:
>
> > (+cc missing people again)
>
> Thank you for adding the recipients, and review, Lorenzo!
>
> >
> > Sorry but we're not going to accept anything that exports THP logic like this at
> > all.
> >
> > And a damon wrapper in core mm code is just a non-starter, so you really need to
> > rethink your approach.
> >
> > I think SJ already commented on this in your v1 from what I can see? I'd listen
> > to his advice on this :)
>
> Lorenzo is right. Not disrupting the world outside of mm/damon/ is the first
> principle of DAMON development. Sometimes we may have to make some changes
> outside of mm/damon/, but we MUST make it not disruptive, small, and perfectly
> aligned with the developers of the area with respects.
The best option is just not doing this. And that might be the case.
we already have pmd level DAMOS_COLLAPSE. I find mTHP-supporting DAMOS_SPLIT
can be implemented without any changes on mm/damon/ external world. If it is
true and there is no objection at doing that, mTHP collapse may not really
necessary. That is, the users could collapse in pmd level first, and then
split in desired mTHP level to accomplish their goal. I think that works for
common use cases, too.
It would be suboptimal to collapse in pmd level first and then split. But the
efficiency is unclear. I don't want to disrupt others for unclear gains. We
can upstream split part first, measure the efficiency, and revisit mTHP
collapse if it turns out to be really needed.
What do you think, Lian?
Thanks,
SJ
[...]