Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp425894ybb; Fri, 3 Apr 2020 05:30:20 -0700 (PDT) X-Google-Smtp-Source: APiQypKqKG6XyNmmDJ/r0/+iICIyO0qxXxmRcR91kKD30C301yfo0Ctg/yIjMhXTL8zbCD32Nk2j X-Received: by 2002:a05:6830:1e10:: with SMTP id s16mr6307528otr.33.1585917020042; Fri, 03 Apr 2020 05:30:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585917020; cv=none; d=google.com; s=arc-20160816; b=fmfp/GxRvVdnewqY7sjBUsy7wkQj/QW4iDMaBdwtswDb56cGtM/A82x6kQTgtGCU9d Om35a0/THKNxzOiY95Vbaqe4fvgGV8CZp9egP9PlfEKEyWiwAxg8AP+rlnRPtHzYv8uc o0ioRhFdHdDPFsn465CD5GE/CE1Wd6ZU8nw8lGz4UbojOPjL74xGSxBMI5+CrengdyHC eZ7Z3NkovI6SyIu3HydC4MozXRPlHXtCVnCDOKbxHwu+T6sJBlSXuJG/SlkYiuBwrGYm TQC1C0i+UDt56K05CBVnBbHMVTg7tHmJtoLv2rWL2uYqkdE0ephTl7WSqhm85VNJmyry XLNQ== 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=5yEswaSUA2DH71ZsH03UY5693O0nZ/nvg6oBTomxklk=; b=HCH7ZWNyzl2dS3G7kPs1vxtt6UtCm6YB8aJFcrr9NXdqVhm/8w1yl6Dp2BbT1GdWj6 Hj7wPZSrniLKCj2XaOSuq1NtbqDs1J6CFJsDxpY9yxyHIqwSgmUrRmFYfMdtvKrci5PC njuBa/muusEjRA8X0+0SCvdBXUEBVBPsad+XbwLLmLsoqoKTirIYMyk9wGy6pEC9ofC9 4Hd3nTLCd07f6Q4qKRSfYAEVDt7QnTUzfTqkckx08UjednQ9iTeuzxZ30NYFl2GeVegP aXwfFSuAZw9rAvRJIDFIqou3LqiaaWfc0WR4MBeN68BtPOH2mVBZIkxzEF++XQ9Vzzx2 WPvQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@shutemov-name.20150623.gappssmtp.com header.s=20150623 header.b="K/3jDpUj"; 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 r11si1906558otd.26.2020.04.03.05.30.06; Fri, 03 Apr 2020 05:30:20 -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="K/3jDpUj"; 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 S2390781AbgDCL3p (ORCPT + 99 others); Fri, 3 Apr 2020 07:29:45 -0400 Received: from mail-lj1-f193.google.com ([209.85.208.193]:42097 "EHLO mail-lj1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728020AbgDCL3i (ORCPT ); Fri, 3 Apr 2020 07:29:38 -0400 Received: by mail-lj1-f193.google.com with SMTP id q19so6512191ljp.9 for ; Fri, 03 Apr 2020 04:29:35 -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=5yEswaSUA2DH71ZsH03UY5693O0nZ/nvg6oBTomxklk=; b=K/3jDpUjVVBeQnEhKWwM3gy5Gru8BoX47Ll9axoy1+xsPYklIrCBMX+fynu8VQkirs c7IdaWFPcUAldS81Lgl8ts8UDyFmKK3wuwf482yQ5bwzcLTPPeeEmvb5bjZbaEtS5n1J 980tEnkeEIMw580fqyrxQAJGlI8ZBc5u0zbNRGkxjEdap7yl1DDi31Sve1b1iRjJtidt K8hYew8M8h7Y4uEk48knMl1An7JC3fl1k9m7z60tTErq8ZJXAOHVNOwOCMj5aGJsNKBT INczse/l8Bw4CLc8ed/WJp0e/iooX+2Y+2EaKM3rsCunrr9NUn1zbLDKNy1WRvbv8m7S GWow== 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=5yEswaSUA2DH71ZsH03UY5693O0nZ/nvg6oBTomxklk=; b=C88z3cFHKYsp1q42HHXJ8Y2RdXAo6DKPiSoGErfq4f/tm7UvDCtccCRRoWXncgLR5n PyI6UrzKSIpPNXMNq6WNaaMWobU/5AjZkClFLsBqo1yIiEQTSuDvqBn1aGcRIOMDbPuu q7yJJq9ZWH6wLxrymY4XY5CxWQaRtdubXN2MZYx+ShY9omi7vdhkDsYiVeEOsgZr1Uhe 4koYw+EvPDpHlb3NpCbq9M95/qPUHGQhfO2+DYtckgOzWSOA513j4ESdL/AvGDncpP9W kFpvbCB2WcCBk6HbQ8sup2ZEW8ZM3ADj59XRuCy0jd2HOJYh4wfJoSYz1FyGp5hxBkF2 GVCA== X-Gm-Message-State: AGi0Puammcf4Y+QUtVmlidPqU2VfhIZx5Ov1WbPOMQrCyAgksFLmnlbs 6m69UvcJ1u+Ts8en9IEPuEnpzQ== X-Received: by 2002:a2e:9718:: with SMTP id r24mr4294536lji.287.1585913374778; Fri, 03 Apr 2020 04:29:34 -0700 (PDT) Received: from box.localdomain ([86.57.175.117]) by smtp.gmail.com with ESMTPSA id j2sm5765073lfh.70.2020.04.03.04.29.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Apr 2020 04:29:33 -0700 (PDT) From: "Kirill A. Shutemov" X-Google-Original-From: "Kirill A. Shutemov" Received: by box.localdomain (Postfix, from userid 1000) id 6B64E101330; 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 2/8] khugepaged: Do not stop collapse if less than half PTEs are referenced Date: Fri, 3 Apr 2020 14:29:22 +0300 Message-Id: <20200403112928.19742-3-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 __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(-) 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; -- 2.26.0