On 4/16/20 8:52 AM, Kirill A. Shutemov wrote:
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
Fine, I will take it. :-)