Re: [PATCH] mm: hugetlb: bail out unmapping after serving reference page

From: Hillf Danton
Date: Thu Mar 22 2012 - 09:21:48 EST


On Thu, Mar 22, 2012 at 5:00 AM, Andrew Morton
<akpm@xxxxxxxxxxxxxxxxxxxx> wrote:
> On Thu, 23 Feb 2012 12:12:38 -0800
> Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> wrote:
>
>> On Thu, 23 Feb 2012 21:05:41 +0800
>> Hillf Danton <dhillf@xxxxxxxxx> wrote:
>>
>> > and a follow-up cleanup also attached.
>>
>> Please, never put more than one patches in an email - it is rather a
>> pain to manually unpick everything.
>>
>> > When unmapping given VM range, a couple of code duplicate, such as pte_page()
>> > and huge_pte_none(), so a cleanup needed to compact them together.
>> >
>> > Signed-off-by: Hillf Danton <dhillf@xxxxxxxxx>
>> > ---
>> >
>> > --- a/mm/hugetlb.c ÂThu Feb 23 20:13:06 2012
>> > +++ b/mm/hugetlb.c ÂThu Feb 23 20:30:16 2012
>> > @@ -2245,16 +2245,23 @@ void __unmap_hugepage_range(struct vm_ar
>> > Â Â Â Â Â Â if (huge_pmd_unshare(mm, &address, ptep))
>> > Â Â Â Â Â Â Â Â Â Â continue;
>> >
>> > + Â Â Â Â Â pte = huge_ptep_get(ptep);
>> > + Â Â Â Â Â if (huge_pte_none(pte))
>> > + Â Â Â Â Â Â Â Â Â continue;
>> > +
>> > + Â Â Â Â Â /*
>> > + Â Â Â Â Â Â* HWPoisoned hugepage is already unmapped and dropped reference
>> > + Â Â Â Â Â Â*/
>> > + Â Â Â Â Â if (unlikely(is_hugetlb_entry_hwpoisoned(pte)))
>> > + Â Â Â Â Â Â Â Â Â continue;
>> > +
>> > + Â Â Â Â Â page = pte_page(pte);
>> > Â Â Â Â Â Â /*
>> > Â Â Â Â Â Â Â* If a reference page is supplied, it is because a specific
>> > Â Â Â Â Â Â Â* page is being unmapped, not a range. Ensure the page we
>> > Â Â Â Â Â Â Â* are about to unmap is the actual page of interest.
>> > Â Â Â Â Â Â Â*/
>> > Â Â Â Â Â Â if (ref_page) {
>> > - Â Â Â Â Â Â Â Â Â pte = huge_ptep_get(ptep);
>> > - Â Â Â Â Â Â Â Â Â if (huge_pte_none(pte))
>> > - Â Â Â Â Â Â Â Â Â Â Â Â Â continue;
>> > - Â Â Â Â Â Â Â Â Â page = pte_page(pte);
>> > Â Â Â Â Â Â Â Â Â Â if (page != ref_page)
>> > Â Â Â Â Â Â Â Â Â Â Â Â Â Â continue;
>> >
>> > @@ -2267,16 +2274,6 @@ void __unmap_hugepage_range(struct vm_ar
>> > Â Â Â Â Â Â }
>> >
>> > Â Â Â Â Â Â pte = huge_ptep_get_and_clear(mm, address, ptep);
>> > - Â Â Â Â Â if (huge_pte_none(pte))
>> > - Â Â Â Â Â Â Â Â Â continue;
>> > -
>> > - Â Â Â Â Â /*
>> > - Â Â Â Â Â Â* HWPoisoned hugepage is already unmapped and dropped reference
>> > - Â Â Â Â Â Â*/
>> > - Â Â Â Â Â if (unlikely(is_hugetlb_entry_hwpoisoned(pte)))
>> > - Â Â Â Â Â Â Â Â Â continue;
>> > -
>> > - Â Â Â Â Â page = pte_page(pte);
>> > Â Â Â Â Â Â if (pte_dirty(pte))
>> > Â Â Â Â Â Â Â Â Â Â set_page_dirty(page);
>> > Â Â Â Â Â Â list_add(&page->lru, &page_list);
>>
>> This changes behaviour when ref_page refers to a hwpoisoned page.
>
> Respond, please?

First say sorry to you, Andrew.

The comment says, HWPoisoned hugepage is already unmapped;
and even if ref_page == HWPoisoned page, it is not added onto
page_list and no page_remove_rmap() is issued for it, so we end
up with no behavior change.

Thanks
-hd
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/