Re: [RFC PATCH v2 2/4] mm/damon: Support for synchrounous huge pages collapse
From: Gutierrez Asier
Date: Wed Mar 11 2026 - 09:11:23 EST
On 3/11/2026 4:02 AM, SeongJae Park wrote:
> On Tue, 10 Mar 2026 16:24:18 +0000 <gutierrez.asier@xxxxxxxxxxxxxxxxxxx> wrote:
>
>> From: Asier Gutierrez <gutierrez.asier@xxxxxxxxxxxxxxxxxxx>
>
> Please add more descriptions of the change, including the motivation.
>
> I assume the motivation is similar to MADV_COLLAPSE that aims to make
> synchronous and therefore faster huge page collapsing impacts copared to
> MADV_HUGEPAGE? It would be nice to make it clear here. Also, if my assumption
> is not wrong, adding a test results showing the benefit of DAMOS_COLLAPSE over
> DAMOS_HUGEPAGE here would be nice.
You are right. I will make it more clear in the cover letter for the next
version.
>
>>
>> Signed-off-by: Asier Gutierrez <gutierrez.asier@xxxxxxxxxxxxxxxxxxx>
>> Co-developed-by: Anatoly Stepanov <stepanov.anatoly@xxxxxxxxxx>
>> ---
>> include/linux/damon.h | 1 +
>> mm/damon/vaddr.c | 3 +++
>> 2 files changed, 4 insertions(+)
>>
>> diff --git a/include/linux/damon.h b/include/linux/damon.h
>> index a4fea23da857..a9cf17b9e8fa 100644
>> --- a/include/linux/damon.h
>> +++ b/include/linux/damon.h
>> @@ -142,6 +142,7 @@ enum damos_action {
>> DAMOS_LRU_DEPRIO,
>> DAMOS_MIGRATE_HOT,
>> DAMOS_MIGRATE_COLD,
>> + DAMOS_COLLAPSE,
>> DAMOS_STAT, /* Do nothing but only record the stat */
>> NR_DAMOS_ACTIONS,
>> };
>> diff --git a/mm/damon/vaddr.c b/mm/damon/vaddr.c
>> index 729b7ffd3565..36791a9a1094 100644
>> --- a/mm/damon/vaddr.c
>> +++ b/mm/damon/vaddr.c
>> @@ -969,6 +969,9 @@ static unsigned long damon_va_apply_scheme(struct damon_ctx *ctx,
>> case DAMOS_NOHUGEPAGE:
>> madv_action = MADV_NOHUGEPAGE;
>> break;
>> + case DAMOS_COLLAPSE:
>> + madv_action = MADV_COLLAPSE;
>> + break;
>> case DAMOS_MIGRATE_HOT:
>> case DAMOS_MIGRATE_COLD:
>> return damos_va_migrate(t, r, scheme, sz_filter_passed);
>> --
>> 2.43.0
>
> The code looks good to me.
>
>
> Thanks,
> SJ
>
> [...]
>
--
Asier Gutierrez
Huawei