Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp4242916ybb; Tue, 14 Apr 2020 03:27:54 -0700 (PDT) X-Google-Smtp-Source: APiQypIPFRgG/FCNl9+OAE3duvfQ95clZrjjITGME0qRu24SRykn2aCoQ5yjQaI/jZF1QOJ1TMh3 X-Received: by 2002:a05:6402:756:: with SMTP id p22mr20186167edy.285.1586860074179; Tue, 14 Apr 2020 03:27:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586860074; cv=none; d=google.com; s=arc-20160816; b=DK7nt+eAHzO3sViJI55sYLiqAUUaqgU8IbT1SMUmyOWzfq8jGCdVDJErnOh+T3n6M8 gJp1b4rCMYVcuWQ1cafC3eYy1SNRZNJNFqTd1eLfPLcTEA06p0bVrLEeQ8DU8JC9bS1c QwdhXFqRqe5dA9RTPntUEWqMpicWGb9TWJKvqsQZhWKSgPLIK7ep9K3MsQoWz66TUvVW NVMZGTIQeQki1a5AJe1Ffz8fiu7VRiTd4sL8lGrP6FC+7/9ZhaJtPDqKjnFoO+eUmUZn lfVWWYm7LWTKG709655XULmyy2F6B/8Q9zoFTpQWtlMBAxitZk+x/GjfkZyh+vnsp3C5 1IRQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :ironport-sdr:ironport-sdr; bh=axsevww4k02Wyqk/nftEJVE5bZ6U1HRdOUZbCCtdiYE=; b=kQSspJfqtkiWD/qKoieLynWgyC+KpPwhLZusacEmoceR+93Yk5ATpmgEIWLMQjxwaZ JyTRMrXRYDnpKwWFqvVxH7+obHshwukPipoxJwVGUoWXj+9LXoc68gxqOLf4QgZPrLGr votnFBASLKpSvwQfwp8dv79LhRrXCMz2yS/lGYUjuOAZe426WFmjp8DqrJWhGnmWDjhn vvq2Mf1RS5Ji5mMGSMiS12b7GeuPXokq4K6isVDY41Nr8y3gvjHlkiDrIjnLCKJYUu/G ENwq14Z1xoMUyn5Px2PIK4G3Gbl7mc2yO5wU3OOc1bqAEc5W9loKRB+Ap+HroouOBICu zRJQ== 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 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=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r1si8589724edq.467.2020.04.14.03.27.30; Tue, 14 Apr 2020 03:27:54 -0700 (PDT) Received-SPF: pass (google.com: best guess record for 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: best guess record for 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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728664AbgDMMw1 (ORCPT + 99 others); Mon, 13 Apr 2020 08:52:27 -0400 Received: from mga12.intel.com ([192.55.52.136]:52670 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728678AbgDMMw0 (ORCPT ); Mon, 13 Apr 2020 08:52:26 -0400 IronPort-SDR: Jw5lZlABpWM74rSQrb/DSdR5A4+YDTg/lh7dVZaj+LaAsx9MKkiRqxxSMzcOzWohmBBM3tUl23 Jw/C1ARtO8MQ== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Apr 2020 05:52:24 -0700 IronPort-SDR: uX4ABe3J8BFw6CE0XOBP3vQpTRfwCI32Qtsy2kGMt35MgULzu1PHKCGCxZoIBH1G+5mttR3MGv gWMt1s4i+C7Q== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.72,378,1580803200"; d="scan'208";a="245132797" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga008.fm.intel.com with ESMTP; 13 Apr 2020 05:52:22 -0700 Received: by black.fi.intel.com (Postfix, from userid 1000) id DE69A1A5; Mon, 13 Apr 2020 15:52:21 +0300 (EEST) From: "Kirill A. Shutemov" To: akpm@linux-foundation.org, Andrea Arcangeli Cc: Zi Yan , Yang Shi , Ralph Campbell , John Hubbard , William Kucharski , linux-mm@kvack.org, linux-kernel@vger.kernel.org, "Kirill A. Shutemov" Subject: [PATCHv3, RESEND 3/8] khugepaged: Drain all LRU caches before scanning pages Date: Mon, 13 Apr 2020 15:52:15 +0300 Message-Id: <20200413125220.663-4-kirill.shutemov@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200413125220.663-1-kirill.shutemov@linux.intel.com> References: <20200413125220.663-1-kirill.shutemov@linux.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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(+) 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; -- 2.26.0