Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp1688531ybz; Thu, 16 Apr 2020 13:44:00 -0700 (PDT) X-Google-Smtp-Source: APiQypIigLHQPBNt6wiMmWlIoUOdbzzjXRwcfL6bH9isW9Tq1ds8ov24b5tOsvIQv63NIy2xR9dI X-Received: by 2002:a17:906:1303:: with SMTP id w3mr11291483ejb.275.1587069840146; Thu, 16 Apr 2020 13:44:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587069840; cv=none; d=google.com; s=arc-20160816; b=ZFGL5OyRbKc1n5Ba0Z8AT0ew5hcD3omxJSHGH9euQdrkF3dVtoMLSuexh4HVnfFPTA jQP+RdjPN642KPAyQdQcyjlQddRpQnL60P1g/LusFchDBuHS4K/n0cK0mYBvM9NWtfGk Ar6fFIBryDQ0PN0znJ1gOHFpiV4qADi2awzS/z5rirtwqMYrGySbzolzVonvMA+7LtwJ K1OPgHTm2+YyhsylqxCPtf3JZaf0zXIhm1I265cYVrlMVM/8jAYrbOo0AnZaldbDh7JU NpU1/L3Q9udxBGsT2FiuhSQEkzT1qIot1RQeXAf9gUJAvHslrcBAjcUXOyPhKbSgcL5t bFTA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=/hrvyhIa02J2uIbOkGtKx2S1Q8LhdDLFUoR9QFbs/BY=; b=yA1ARql5Npe4gjWNHQFHhJ/Pu09adphtEdtc9r50xooG8AFu9prL55+2Zy0g6SyHNd BlAJxLTz1auxsdd6pjoXoOHMthPbv3bdLnkFmEXBxGJNkUUF5q7Lco73HQ/OtkiJb9si yPncFptLUPY7qRZfeOhle18yzZH9vVcNAJ/2zajNXfNIll3a3mfsmb11IktykbSahG+Q 9ujIqAHtJHvcP4G6g4jXThjtv+qNf6vvsut+h9g8+YhSvB7IoB+huH4gmeJZjLnUnmio 4wqIY92OGYhCj4mVQz1ONJqfjTa/o0BBuZwhh+veNRHeGrXAjdyoFmBnWbD7zUW0HV9w sUJw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ck5si12657510ejb.12.2020.04.16.13.43.37; Thu, 16 Apr 2020 13:44:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731593AbgDPS0E (ORCPT + 99 others); Thu, 16 Apr 2020 14:26:04 -0400 Received: from out30-133.freemail.mail.aliyun.com ([115.124.30.133]:34506 "EHLO out30-133.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726435AbgDPS0C (ORCPT ); Thu, 16 Apr 2020 14:26:02 -0400 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R101e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e07425;MF=yang.shi@linux.alibaba.com;NM=1;PH=DS;RN=10;SR=0;TI=SMTPD_---0TvjuKXH_1587061557; Received: from US-143344MP.local(mailfrom:yang.shi@linux.alibaba.com fp:SMTPD_---0TvjuKXH_1587061557) by smtp.aliyun-inc.com(127.0.0.1); Fri, 17 Apr 2020 02:26:00 +0800 Subject: Re: [PATCHv3, RESEND 8/8] khugepaged: Introduce 'max_ptes_shared' tunable To: "Kirill A. Shutemov" Cc: "Kirill A. Shutemov" , akpm@linux-foundation.org, Andrea Arcangeli , Zi Yan , Ralph Campbell , John Hubbard , William Kucharski , linux-mm@kvack.org, linux-kernel@vger.kernel.org References: <20200413125220.663-1-kirill.shutemov@linux.intel.com> <20200413125220.663-9-kirill.shutemov@linux.intel.com> <20200416155206.bqpd5p45oud4chg6@box> From: Yang Shi Message-ID: <33a19097-5b4f-ea6e-6d6e-3ccda56607f5@linux.alibaba.com> Date: Thu, 16 Apr 2020 11:25:56 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: <20200416155206.bqpd5p45oud4chg6@box> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. :-) >