Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp3573902ybb; Mon, 6 Apr 2020 11:17:06 -0700 (PDT) X-Google-Smtp-Source: APiQypLQSET0+GBtnTOl7ATcDIuZhyglL+3cs0HzwqmaeZ8VrTbe78ZWc9YfG5+Mk8M6QOKAipYH X-Received: by 2002:aca:f384:: with SMTP id r126mr491685oih.41.1586197026076; Mon, 06 Apr 2020 11:17:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586197026; cv=none; d=google.com; s=arc-20160816; b=aI+T2Qdd9R9L0qce7LsCa45zjMUQvC49q6/Da1OO9D/AB2l+wsfQHNDuc0x8DLtIca KWAvSCMqr5kJjfzlid3RjjdDpHjp0ZOVi/r1hFPHv5bUPjUbL/QGx/Q/0uXTFIno+lec +tHqGOw872TlDQbcDLYMC3cHfhV1d9BqNE7f/n0afRE/ScUDFNHa5whf0F3TdX5QVlot /CTMhTWZQt9cydNpWg5+oR0OQH2DMtooUc4RAbY1R8NT77vltCglN9dIpJKXLqHLDfO4 586XHaUmruU2FkTX0Zo/mnGpD0a/iF9jgJg9ruBU97Wh84Fyum4M1pmiLLcoAc3NQiwb Z62A== 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=ZeYZhS0vPrXJPZB8Dh6X6GBtT5OqF5uQyAwACnnoiLw=; b=TVq9ovgnhBLN/l9ydQmayl4bmLmcx/cfrjdK7ts5OLykZRsmWa9Fv9RtmIHEJO/tcA Nm5XKhdDs59/0QbsNVPi0y3XbQlIYSTGbXTSaljH4YSNBVqXDvwcA98eINJDcrutuuKA CrU5Dn7gkCpNUIBhvtcXdupISS9/yTkDSBedwztOvmnbfjqPwZLhOZpf8H91Bl6aOSXS 2TZWnz27b8Hy832qJfkke0sNYIL994ye2QhUJe7z773+tWiIRj8XrS1Z8WHBaw3CZOCS LWsE/3oCBbjxFZVkRCru+RdjN4TcP+TAF0BMQt2uxfJ+ICpDUBFFqZ3lD7YgXyFdm8dL pmpg== 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 h81si93765oif.20.2020.04.06.11.16.41; Mon, 06 Apr 2020 11:17:06 -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 S1726616AbgDFSQF (ORCPT + 99 others); Mon, 6 Apr 2020 14:16:05 -0400 Received: from out30-131.freemail.mail.aliyun.com ([115.124.30.131]:39416 "EHLO out30-131.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726523AbgDFSQF (ORCPT ); Mon, 6 Apr 2020 14:16:05 -0400 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R361e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e01358;MF=yang.shi@linux.alibaba.com;NM=1;PH=DS;RN=7;SR=0;TI=SMTPD_---0Tuq9-ti_1586196959; Received: from US-143344MP.local(mailfrom:yang.shi@linux.alibaba.com fp:SMTPD_---0Tuq9-ti_1586196959) by smtp.aliyun-inc.com(127.0.0.1); Tue, 07 Apr 2020 02:16:01 +0800 Subject: Re: [PATCHv2 3/8] khugepaged: Drain all LRU caches before scanning pages 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-4-kirill.shutemov@linux.intel.com> From: Yang Shi Message-ID: <3f0514c3-7f1e-0ba0-b458-683600bd5905@linux.alibaba.com> Date: Mon, 6 Apr 2020 11:15:58 -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-4-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: > Having a page in LRU add cache offsets page refcount and gives > false-negative on PageLRU(). It reduces collapse success rate. > > Drain all LRU add caches before scanning. It happens relatively > rare and should not disturb the system too much. > > Signed-off-by: Kirill A. Shutemov Acked-by: Yang Shi > --- > mm/khugepaged.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/mm/khugepaged.c b/mm/khugepaged.c > index 14d7afc90786..fdc10ffde1ca 100644 > --- a/mm/khugepaged.c > +++ b/mm/khugepaged.c > @@ -2065,6 +2065,8 @@ static void khugepaged_do_scan(void) > > barrier(); /* write khugepaged_pages_to_scan to local stack */ > > + lru_add_drain_all(); > + > while (progress < pages) { > if (!khugepaged_prealloc_page(&hpage, &wait)) > break;