[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAGsJ_4zBpL6a5ORAQUFwZMM+ikmMS8JSo9enLDZ7VFT9kkge+A@mail.gmail.com>
Date: Sun, 8 Feb 2026 06:17:41 +0800
From: Barry Song <21cnbao@...il.com>
To: "David Hildenbrand (Arm)" <david@...nel.org>
Cc: Lance Yang <lance.yang@...ux.dev>, Vernon Yang <vernon2gm@...il.com>, akpm@...ux-foundation.org,
lorenzo.stoakes@...cle.com, ziy@...dia.com, dev.jain@....com,
linux-mm@...ck.org, linux-kernel@...r.kernel.org,
Vernon Yang <yanglincheng@...inos.cn>
Subject: Re: [PATCH mm-new v7 4/5] mm: khugepaged: skip lazy-free folios
On Sun, Feb 8, 2026 at 6:05 AM David Hildenbrand (Arm) <david@...nel.org> wrote:
>
> On 2/7/26 23:01, Barry Song wrote:
> > On Sun, Feb 8, 2026 at 5:38 AM David Hildenbrand (Arm) <david@...nel.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.
agree. But this brings us back to the philosophy of the original patch.
If there is no memory pressure, lazyfree folios won’t be dropped, so
collapsing them might also be reasonable.
Just collapsing fully lazyfree folios with VM_DROPPABLE while
skipping partially lazyfree VMAs seems a bit confusing to me :-)
Thanks
Barry
Powered by blists - more mailing lists