Re: [PATCH] mm/rmap: don't discard lazyfree THPs at PMD level

From: David Hildenbrand (Arm)

Date: Mon Oct 12 2026 - 11:34:04 EST



>>> --- a/mm/rmap.c
>>> +++ b/mm/rmap.c
>>> @@ -2275,17 +2275,6 @@ static bool try_to_unmap_one(struct folio *folio, struct vm_area_struct *vma,
>>> }
>>>
>>> if (!pvmw.pte) {
>>> - if (folio_test_lazyfree(folio)) {
>>> - if (unmap_huge_pmd_locked(vma, pvmw.address, pvmw.pmd, folio))
>>
>> This is the only caller of unmap_huge_pmd_locked(), making that and
>> __discard_anon_folio_pmd_locked() dead code, shouldn't we remove all of it?
>>
>> Otherwise we're leaving dead code around.
>
> 1) it keeps the backport small, 2) I am going to restore the function and
> this reduce the code churn.
>
> I can remove the dead code if you think that is better.

Leave it in and let's clarify that we'll restore the functionality shortly.

--
Cheers,

David