Re: [PATCHv3, RESEND 8/8] khugepaged: Introduce 'max_ptes_shared' tunable

From: Kirill A. Shutemov
Date: Thu Apr 16 2020 - 11:52:16 EST


On Wed, Apr 15, 2020 at 02:25:30PM -0700, Yang Shi wrote:
> > @@ -595,6 +626,12 @@ static int __collapse_huge_page_isolate(struct vm_area_struct *vma,
> > VM_BUG_ON_PAGE(!PageAnon(page), page);
> > + if (page_mapcount(page) > 1 &&
> > + ++shared > khugepaged_max_ptes_shared) {
> > + result = SCAN_EXCEED_SHARED_PTE;
>
> It may be better to extract the check into a helper? For example, bool
> exceed_max_ptes_shared(struct page)?

It might be reasonable as part of wider cleanup: the same has to be done
to khugepaged_max_ptes_none and khugepaged_max_ptes_swap.

Volunteers? :P

--
Kirill A. Shutemov