Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp3573005ybb; Mon, 6 Apr 2020 11:16:14 -0700 (PDT) X-Google-Smtp-Source: APiQypLf9BcHdD3WqSZWyjz8Tt4/K9J7wLR2Bzash2uURYzHgk3fiUfdc8B7DZIM8/BDCpANXIcq X-Received: by 2002:a4a:3f19:: with SMTP id e25mr363621ooa.67.1586196973882; Mon, 06 Apr 2020 11:16:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586196973; cv=none; d=google.com; s=arc-20160816; b=Jyrd/uW/7D1rdXTAT6zOfuZLVfgq8shcxUEP1c1Z5ayPQ00ifhd0mOeBXn6VgW1vSC 2ERXSn0OJl99RlHRC0qoP2Nv4QT2xoB74SU/CQiCpE4gUMkkCztMP7ieEbl84R2Rx4sl l9wNUotW8IFYESzGbwIjkTgSbrcrYO9oOIQBBo/55h6hC2aQLZ+YkFL9UJ3/IRVMKgNg oUnC6AO3uLbOmhMDU/MTqlQYKrKHmF6UAPCKQ7g1G26/L5DdYECRp9vAO5h7wo8FBCXR mXpUaRBWs4r6MuYiwHbLU/nZWR4T5r4RQgSukYbvbL88hJkSR5sOVIjlHf49v96S9ghm 1PZA== 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=EV1HOG+TjP24X8URdSijxzWMcptAx6QBXEkUM/1V21I=; b=XsVvVEPtLPKs0LHxk5SzaTegJdfAWYIcaDz1mRkB8qcmNm80XJXPG+XRlJpJNiOP/2 dzSRisxA7wWg7DhL6x08zW/u1naNZ+MZib5w6iMftCbYbtryIPbBXCN/sIGJ88Ablruw wJGa6iRTZt3q0gIj9TQ9IBykvr36ISrXREK7+RTEFN6oVKkoIwVMe7ilbuwrUqXf74Fw bXokkzSwMAI/2PryRWIO4OjdxaROfDOt6+URiyDZpsyLpyhyFKeOqNUwkuAxTi0biH/z aBbvTjs6MqoBWG5nT/uxJqbNSEMYh/HiqVWwgisWyXDMTKV7cuwoh2Q5R3lVKzb1tLZA /c9Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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. [209.132.180.67]) by mx.google.com with ESMTP id l11si92577oib.32.2020.04.06.11.15.50; Mon, 06 Apr 2020 11:16:13 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S1726608AbgDFSNm (ORCPT + 99 others); Mon, 6 Apr 2020 14:13:42 -0400 Received: from out30-42.freemail.mail.aliyun.com ([115.124.30.42]:34057 "EHLO out30-42.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726520AbgDFSNm (ORCPT ); Mon, 6 Apr 2020 14:13:42 -0400 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R481e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e01422;MF=yang.shi@linux.alibaba.com;NM=1;PH=DS;RN=7;SR=0;TI=SMTPD_---0TuqA70k_1586196816; Received: from US-143344MP.local(mailfrom:yang.shi@linux.alibaba.com fp:SMTPD_---0TuqA70k_1586196816) by smtp.aliyun-inc.com(127.0.0.1); Tue, 07 Apr 2020 02:13:38 +0800 Subject: Re: [PATCHv2 2/8] khugepaged: Do not stop collapse if less than half PTEs are referenced To: "Kirill A. Shutemov" , akpm@linux-foundation.org, Andrea Arcangeli Cc: Zi Yan , linux-mm@kvack.org, linux-kernel@vger.kernel.org, "Kirill A. Shutemov" References: <20200403112928.19742-1-kirill.shutemov@linux.intel.com> <20200403112928.19742-3-kirill.shutemov@linux.intel.com> From: Yang Shi Message-ID: <238a9a53-cf9b-7729-46f1-9b2a5e37571a@linux.alibaba.com> Date: Mon, 6 Apr 2020 11:13:35 -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: <20200403112928.19742-3-kirill.shutemov@linux.intel.com> 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/3/20 4:29 AM, Kirill A. Shutemov wrote: > __collapse_huge_page_swapin() check number of referenced PTE to decide > if the memory range is hot enough to justify swapin. > > The problem is that it stops collapse altogether if there's not enough > referenced pages, not only swappingin. > > Signed-off-by: Kirill A. Shutemov > Fixes: 0db501f7a34c ("mm, thp: convert from optimistic swapin collapsing to conservative") > Reviewed-by: Zi Yan > --- > mm/khugepaged.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) Acked-by: Yang Shi > > diff --git a/mm/khugepaged.c b/mm/khugepaged.c > index 99bab7e4d05b..14d7afc90786 100644 > --- a/mm/khugepaged.c > +++ b/mm/khugepaged.c > @@ -905,7 +905,8 @@ static bool __collapse_huge_page_swapin(struct mm_struct *mm, > /* we only decide to swapin, if there is enough young ptes */ > if (referenced < HPAGE_PMD_NR/2) { > trace_mm_collapse_huge_page_swapin(mm, swapped_in, referenced, 0); > - return false; > + /* Do not block collapse, only skip swapping in */ > + return true; > } > vmf.pte = pte_offset_map(pmd, address); > for (; vmf.address < address + HPAGE_PMD_NR*PAGE_SIZE;