From: "David Hildenbrand (Arm)" <david@kernel.org>
To: Barry Song <21cnbao@gmail.com>
Cc: Lance Yang <lance.yang@linux.dev>,
Vernon Yang <vernon2gm@gmail.com>,
akpm@linux-foundation.org, lorenzo.stoakes@oracle.com,
ziy@nvidia.com, dev.jain@arm.com, linux-mm@kvack.org,
linux-kernel@vger.kernel.org,
Vernon Yang <yanglincheng@kylinos.cn>
Subject: Re: [PATCH mm-new v7 4/5] mm: khugepaged: skip lazy-free folios
Date: Sat, 7 Feb 2026 23:05:44 +0100 [thread overview]
Message-ID: <bd36d92d-dbf1-4818-bb31-0330c1f53577@kernel.org> (raw)
In-Reply-To: <CAGsJ_4yEfgipUe37_k5rArrYMPY_31JUKQGjRk+NNJTK9QhBWQ@mail.gmail.com>
On 2/7/26 23:01, Barry Song wrote:
> On Sun, Feb 8, 2026 at 5:38 AM David Hildenbrand (Arm) <david@kernel.org> wrote:
>>
>> On 2/7/26 14:51, Lance Yang wrote:
>>>
>>>
>>>
>>> Good catch!
>>>
>>
>> Good point!
>>
>>>
>>> Right. When the VMA has VM_DROPPABLE, we would drop the lazyfree folio
>>> regardless of whether it (or the PTE) is dirty in try_to_unmap_one().
>>>
>>> So, IMHO, we could go with:
>>>
>>> cc->is_khugepaged && folio_test_lazyfree(folio) &&
>>> (!pte_dirty(pteval) || (vma->vm_flags & VM_DROPPABLE))
>>
>> Hm. In a VM_DROPPABLE mapping all folios should be marked as lazy-free
>> (see folio_add_new_anon_rmap()).
>>
>> The new (collapse) folio will also be marked lazy (due to
>> folio_add_new_anon_rmap()) free and can just get dropped any time.
>>
>> So likely we should just not skip collapse for lazyfree folios in
>> VM_DROPPABLE mappings?
>
> Maybe change “just not skip” to “just skip”?
>
> If the goal is to avoid the collapse overhead for folios that are
> about to be dropped, we might consider skipping collapse for the
> entire VMA?
If there is no memory pressure in the system, why wouldn't you just want
to collapse in a VM_DROPPABLE region?
"about to be dropped" only applies once there is actual memory pressure.
If not, these pages stick around forever.
--
Cheers,
David
next prev parent reply other threads:[~2026-02-07 22:05 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-07 8:16 [PATCH mm-new v7 0/5] Improve khugepaged scan logic Vernon Yang
2026-02-07 8:16 ` [PATCH mm-new v7 1/5] mm: khugepaged: add trace_mm_khugepaged_scan event Vernon Yang
2026-02-07 8:16 ` [PATCH mm-new v7 2/5] mm: khugepaged: refine scan progress number Vernon Yang
2026-02-08 9:17 ` Dev Jain
2026-02-08 13:25 ` Vernon Yang
2026-02-18 3:55 ` Vernon Yang
2026-02-18 8:05 ` David Hildenbrand (Arm)
2026-02-07 8:16 ` [PATCH mm-new v7 3/5] mm: add folio_test_lazyfree helper Vernon Yang
2026-02-07 8:16 ` [PATCH mm-new v7 4/5] mm: khugepaged: skip lazy-free folios Vernon Yang
2026-02-07 8:34 ` Barry Song
2026-02-07 13:51 ` Lance Yang
2026-02-07 21:38 ` David Hildenbrand (Arm)
2026-02-07 22:01 ` Barry Song
2026-02-07 22:05 ` David Hildenbrand (Arm) [this message]
2026-02-07 22:17 ` Barry Song
2026-02-07 22:25 ` David Hildenbrand (Arm)
2026-02-07 22:31 ` Barry Song
2026-02-08 13:26 ` Vernon Yang
2026-02-08 4:06 ` Lance Yang
2026-02-07 8:16 ` [PATCH mm-new v7 5/5] mm: khugepaged: set to next mm direct when mm has MMF_DISABLE_THP_COMPLETELY Vernon Yang
-- strict thread matches above, loose matches on Subject: below --
2026-02-07 8:11 [PATCH mm-new v7 0/5] Improve khugepaged scan logic Vernon Yang
2026-02-07 8:11 ` [PATCH mm-new v7 4/5] mm: khugepaged: skip lazy-free folios Vernon Yang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=bd36d92d-dbf1-4818-bb31-0330c1f53577@kernel.org \
--to=david@kernel.org \
--cc=21cnbao@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=dev.jain@arm.com \
--cc=lance.yang@linux.dev \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=lorenzo.stoakes@oracle.com \
--cc=vernon2gm@gmail.com \
--cc=yanglincheng@kylinos.cn \
--cc=ziy@nvidia.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox