Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp749679ybz; Wed, 15 Apr 2020 18:07:42 -0700 (PDT) X-Google-Smtp-Source: APiQypI8gX266zpnUgqSZaQ3m2Oo1R5HBN5dhbyNjENV90eKwNnatwy/AtlRie0xlLfsAXLECILD X-Received: by 2002:a17:907:11de:: with SMTP id va30mr7483071ejb.121.1586999262664; Wed, 15 Apr 2020 18:07:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586999262; cv=none; d=google.com; s=arc-20160816; b=RmY6PeZnKEnIsVR/ZNv2Q7+KZZJt1PUnZv3MZU+mERf/2FTqNQFo91HKn1BFenPUPN XXyUMFwZT0F5bbFZgi18EpYtOJbCxztlJnGh42d6Z3zdaZtJzss/Cm6NW+/9cQhlcNjq keHdTrKPI5cxJacRARgQE135pb8gfOe0JsQ+U4D/ZllsY4C7O+GxIgpNU2qztZAMh9oD ZyX69952yFPEkHeL/81vrrXlGZboLCeXrL0OBsfOls1S6YsOiQYvEYMIVTT+7ClmR7cD SGYvKX155WLWuSClXgRPVYLBlPKFmHKmzBxXNvr7XUnfair8SjZcwLYjfnO0qJ2KC+KY OMhA== 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=2O1tv8oNT1ur+iOgxePegh4K72yRqxjUSJA5OyrK8TM=; b=dz7c+owpxDOxAb4DPk4x4y1Ge7hlrwZ78jQSUE7UcKFKLNj5L1xtNvhOchjeltnHpZ JEJlGew6n0+KLYYRX04rDAt18d+Frrn7PZTc3QSolG8LqBcAKoKNE8zegDiouGPX0qGg QEzupheOq5BopVAZEEM6+WYvybiW6wh3OZZh8uf7c/gJmQQZ5iAuXC2vJ891ICAptXRv jSjd8vR4kNkoGjhrYllIKPfe9pjfmg/DKKlOXcEaBqNXTu4P89pTHLKbmirHLCEKIhk9 Es0UvnECPFVJwKWXKiIAQr31q068aUo7rMv1YB9u2t0y4+UEuiIscNOjFhBMixVyH7a+ pc7A== 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 oc19si6090326ejb.487.2020.04.15.18.07.15; Wed, 15 Apr 2020 18:07:42 -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 S2636969AbgDOUcc (ORCPT + 99 others); Wed, 15 Apr 2020 16:32:32 -0400 Received: from out30-131.freemail.mail.aliyun.com ([115.124.30.131]:46249 "EHLO out30-131.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2636948AbgDOUcH (ORCPT ); Wed, 15 Apr 2020 16:32:07 -0400 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R111e4;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=9;SR=0;TI=SMTPD_---0TvdyiWI_1586982722; Received: from US-143344MP.local(mailfrom:yang.shi@linux.alibaba.com fp:SMTPD_---0TvdyiWI_1586982722) by smtp.aliyun-inc.com(127.0.0.1); Thu, 16 Apr 2020 04:32:04 +0800 Subject: Re: [PATCHv3, RESEND 3/8] khugepaged: Drain all LRU caches before scanning pages To: "Kirill A. Shutemov" , akpm@linux-foundation.org, Andrea Arcangeli Cc: 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-4-kirill.shutemov@linux.intel.com> From: Yang Shi Message-ID: <63b9ce4d-0e1d-8e40-5ec3-154fe6e95557@linux.alibaba.com> Date: Wed, 15 Apr 2020 13:31: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: <20200413125220.663-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/13/20 5:52 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 > --- > mm/khugepaged.c | 2 ++ > 1 file changed, 2 insertions(+) Acked-by: Yang Shi > > diff --git a/mm/khugepaged.c b/mm/khugepaged.c > index 5968ec5ddd6b..ee66c140c2d6 100644 > --- a/mm/khugepaged.c > +++ b/mm/khugepaged.c > @@ -2059,6 +2059,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;