Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp375578ybb; Fri, 3 Apr 2020 04:31:42 -0700 (PDT) X-Google-Smtp-Source: APiQypJ5ZkT+EwdzabZLMIc9YHK7ZxsCytQQNdHIZtzy4aiL6OIVt/kUU86VdVLIef0PXHlS7D1E X-Received: by 2002:aca:3101:: with SMTP id x1mr2460754oix.15.1585913502046; Fri, 03 Apr 2020 04:31:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585913502; cv=none; d=google.com; s=arc-20160816; b=Zh4WvguT1o04mJSZcB6OQT0CcsKmbBfMSBuEJ4hbRKToro2qsZpsHFWKCnEouNCzFb 2VxsKglR6+AZge0WPWjXLOOL3hoQYsIJe0KOhbISKFiLX1OnKaK3yarNc45LblHdDEhP RKRPCrK/suRIxDKk25hqSwsFimoxrposFdED7Khfyn6/AQikz5xwPJGxVIjmejeCTCVR eDr5IqNSVlg892YFieZhEON94vRiVJfyrX9s78eX42TLsc7gi34qHl5H280KWd63BTeB 8aRITIL3HWf+XqqgtjJ+2sF5jUOFDK2SGGFq+CEARHeiAXzEjuFAaTdh4mcCxOHGtlv7 pYoA== 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 :dkim-signature; bh=UDV67uaM0olVe42g3gcRUTFOTLKxm8Yf483YPZ3Dud8=; b=locPY6uS5HotiGq2JcFe07W8GQifNY42OxqO4G8nR/n49agu1CM87R36Pf9FqYVzuA SRSZZ931KOqxR/SKFQp2QsRneOoejdOKZ3azt+tNj/HoecDmMLWRpAky0n5iIxYXQtLR A9Div2aHvfi84ANcx7lzPQy6Y4qLZFz80GbXTKI4L7SeiTf+YSlj71b4aOid2/KpHF7C pkNyZQWBU2MmPujYBN1v9j+qVPp6tsdlLJnjpW0F6nUJcX/CPj6XwVOCoiuiCNHbILxi 8krSXNsrSHPHAP3H1R4TCP5d9/OoyUaUNmU8VIRXn1xEoYYcpbeoOJs0yHSzWi94UxWi XbxA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@shutemov-name.20150623.gappssmtp.com header.s=20150623 header.b=sCxEbPsB; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v1si3596148otp.155.2020.04.03.04.31.28; Fri, 03 Apr 2020 04:31:42 -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; dkim=pass header.i=@shutemov-name.20150623.gappssmtp.com header.s=20150623 header.b=sCxEbPsB; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390673AbgDCL3g (ORCPT + 99 others); Fri, 3 Apr 2020 07:29:36 -0400 Received: from mail-lj1-f178.google.com ([209.85.208.178]:42676 "EHLO mail-lj1-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728020AbgDCL3f (ORCPT ); Fri, 3 Apr 2020 07:29:35 -0400 Received: by mail-lj1-f178.google.com with SMTP id q19so6512128ljp.9 for ; Fri, 03 Apr 2020 04:29:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=shutemov-name.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=UDV67uaM0olVe42g3gcRUTFOTLKxm8Yf483YPZ3Dud8=; b=sCxEbPsBTakoE1xknw2RtO2rz8oxNAb6cCS8SzCviLU+wXJ5m+DFbQMKB/W7GcAtYQ D/0LK1slWaUCNicIxwMSPPcXyy0SuopgawhAqBDv8LGru/h2Rz//tPVcOCiAX0SeMfie Rtmac2n0Qy8TbXeXOE4KNNFMQCPwok9lSTX2O0YBd41GsuzvfaBW+oKM/+RQaey1e1CJ F7HBir5eC9AV6iJ3nDVZiaM9M6YOksUJ7CwPnmOYtDbgDLtLnz60hL49JSVAixZuYBQv zN9NlOYVLhwtvCwlZiirwMvkOanRxXL2qLV3wkgtzXR8972SVxScB7hqZL3eWlOC48Ye rPZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=UDV67uaM0olVe42g3gcRUTFOTLKxm8Yf483YPZ3Dud8=; b=mnxP2P+/YvjPdXFRfDsGn7tFfdtAMQUQwE/2p4tBXsEGJTesjSf9HCN3TC9cOYvdK9 et3FaS0g1v6T8rSCoxrvMBxWgj07nAzkwsPdKmJ75ZyqgAspBsg7HI0DE8/hnAkkPFdy OrVRm37vQkyEr3twy9pc1t/k6bpF41/4nup6esj9PH1VInfijhd03gvx5IZJSMOBrkne y3L3TpbSDa5nmp3F6y27rRpwplwfComrmYLFVK711r7hfcunhH3KseH6OB2NfNTEuIZY spVnIx1jxHu8voNpErn/QZ/9pPexoVw3/AF/nrlRCDZoVsz/HgVVYBcQyWXs8MgRej0e oVXA== X-Gm-Message-State: AGi0PuYIdTG2Mb0PN6Ek/cibk9vUtLYvnJLH+2Cne2oc/WrAY901pdlZ pz2yiVoQ+7p1NarUwAuGv/Bxug== X-Received: by 2002:a2e:3203:: with SMTP id y3mr4372576ljy.54.1585913373250; Fri, 03 Apr 2020 04:29:33 -0700 (PDT) Received: from box.localdomain ([86.57.175.117]) by smtp.gmail.com with ESMTPSA id g5sm4839412ljl.106.2020.04.03.04.29.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Apr 2020 04:29:32 -0700 (PDT) From: "Kirill A. Shutemov" X-Google-Original-From: "Kirill A. Shutemov" Received: by box.localdomain (Postfix, from userid 1000) id 720FE101331; Fri, 3 Apr 2020 14:29:31 +0300 (+03) To: akpm@linux-foundation.org, Andrea Arcangeli Cc: Zi Yan , Yang Shi , linux-mm@kvack.org, linux-kernel@vger.kernel.org, "Kirill A. Shutemov" Subject: [PATCHv2 3/8] khugepaged: Drain all LRU caches before scanning pages Date: Fri, 3 Apr 2020 14:29:23 +0300 Message-Id: <20200403112928.19742-4-kirill.shutemov@linux.intel.com> X-Mailer: git-send-email 2.26.0 In-Reply-To: <20200403112928.19742-1-kirill.shutemov@linux.intel.com> References: <20200403112928.19742-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 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; -- 2.26.0