From patchwork Thu Apr 26 14:27:56 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zi Yan X-Patchwork-Id: 905093 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=linux-snps-arc-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=sent.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="XOjjkja1"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=sent.com header.i=@sent.com header.b="LcE/01FS"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="jjnFUBmk"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40Wzx23f8Cz9ry1 for ; Fri, 27 Apr 2018 00:29:58 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=mABo0g9esh72poe/gu3j2L41qd09Cgm623zGvEjw820=; b=XOjjkja1oaQB6bAoQtok09La2H glbr/NdJh7l0dL5xqlj6Drw/4PRrC8N3fgfgLsQ/K394wwcYL8LB4HB6mHz2ste1EXtfiKrREENt7 Eh75VubR2xxOwFVJwemh+eOwLo7B9GX+elPKxc6jUI9QAS5oLL5WzdR2NTk236xa8lxBVyFlMO2o7 qH5veeMUgkEXIKc8up1ajvylunGU3MbqcUYalTmJzW19oYIzhtWcfkjG4vkjEtp0xQ5dmcKbJXEUp wFH0KB/0OLOm+22SmkO5FsjjImn8HfIa3RJ2OAeKN8zp5ee8eYboFDDZrL+vUgZnUXLlkFZFiOUPO sidT1VBQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fBhuC-0008FV-CE; Thu, 26 Apr 2018 14:29:52 +0000 Received: from out2-smtp.messagingengine.com ([66.111.4.26]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fBhtQ-0007h9-1y for linux-snps-arc@lists.infradead.org; Thu, 26 Apr 2018 14:29:09 +0000 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id A860A21603; Thu, 26 Apr 2018 10:28:50 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Thu, 26 Apr 2018 10:28:50 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sent.com; h=cc :date:from:in-reply-to:message-id:references:subject:to :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; bh=t1a6EmtETARsZyOc4 jqW+ezOvO1lt6LGOLnd4YVwTyM=; b=LcE/01FSj1vyybqGueOd7UNO8kY28ePpJ Om5TLq/hoJiO5OMwn6cm5eAuvoWKzaeUnA+cuTYnDl0dF7pkWxAmPmxywn4pGenv Y8V5sIDc2ivXnWzXh9nLPcc+ElZbLzkZRzn1B4ncb6wiRsZ2W8ZYk5qDv1MVqtsz 2yhj3UBcwLetA6eESs8rlFHH9OaZZbjoacvNGwUTCLkqDVMH86w0Ic7QuCxLgS/C Xa5sttJJSApsJfEKlKuvXDBLyBKp+UtNk1n1A1Zk/EgEI31CLIOb93p4cJr6bfAx vtl8nQHmsU5TPrFtHhofz61iHpiubB4IHypjRBlhAkyZovxWrAQiA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; bh=t1a6EmtETARsZyOc4jqW+ezOvO1lt6LGOLnd4YVwTyM=; b=jjnFUBmk 81LNZtV+QvFH2PTOFTrVbA08f1UPvM/vzzNGq5UgllAkdy7kQfPCRWzVkFTdKFN9 w6xgDtk4kp3z+hv+PUedQjimq8pQwgkx/+o5F0N4ORKgHvVTkkD10UZ2mQv12lzY ZyxqwGwLIMgrCiYtWEfYYJjZGjrV6A3sak+0kj1sQi7u16OkkYaUoqyzYcFYaFxZ av899YmIR+Mnme4rVaCEW/3La/8M1wrAimAod7OdPQS1un1UuN9/5bqqc6hqp1J9 PMkPsBu7spjTTlAMkpgjBIH07vgN3CnMB69BQdmFMBUG2zmtFL/CN7QgyTW/JarT eG2ZHKZeUqk62w== X-ME-Sender: Received: from tenansix.rutgers.edu (pool-165-230-225-59.nat.rutgers.edu [165.230.225.59]) by mail.messagingengine.com (Postfix) with ESMTPA id 63356E4921; Thu, 26 Apr 2018 10:28:50 -0400 (EDT) From: Zi Yan To: linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [RFC PATCH 1/9] arc: mm: migrate: add pmd swap entry to support thp migration. Date: Thu, 26 Apr 2018 10:27:56 -0400 Message-Id: <20180426142804.180152-2-zi.yan@sent.com> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180426142804.180152-1-zi.yan@sent.com> References: <20180426142804.180152-1-zi.yan@sent.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180426_072904_230219_381896B1 X-CRM114-Status: UNSURE ( 5.70 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.8 (/) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-0.8 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [66.111.4.26 listed in list.dnswl.org] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (zi.yan[at]sent.com) -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid X-BeenThere: linux-snps-arc@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Linux on Synopsys ARC Processors List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Vineet Gupta , linux-snps-arc@lists.infradead.org, Zi Yan MIME-Version: 1.0 Sender: "linux-snps-arc" Errors-To: linux-snps-arc-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org From: Zi Yan Signed-off-by: Zi Yan Cc: Vineet Gupta Cc: linux-snps-arc@lists.infradead.org Cc: linux-mm@kvack.org --- arch/arc/include/asm/pgtable.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/arc/include/asm/pgtable.h b/arch/arc/include/asm/pgtable.h index 08fe33830d4b..246934105e61 100644 --- a/arch/arc/include/asm/pgtable.h +++ b/arch/arc/include/asm/pgtable.h @@ -383,7 +383,9 @@ void update_mmu_cache(struct vm_area_struct *vma, unsigned long address, /* NOPs, to keep generic kernel happy */ #define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) }) +#define __pmd_to_swp_entry(pmd) ((swp_entry_t) { pmd_val(pmd) }) #define __swp_entry_to_pte(x) ((pte_t) { (x).val }) +#define __swp_entry_to_pmd(x) ((pmd_t) { (x).val }) #define kern_addr_valid(addr) (1) From patchwork Thu Apr 26 14:28:04 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zi Yan X-Patchwork-Id: 905107 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=linux-snps-arc-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=sent.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="qR2jfmq+"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=sent.com header.i=@sent.com header.b="tbbKn+qf"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="TvaKzvrF"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40X0JV2x4Gz9ry1 for ; Fri, 27 Apr 2018 00:46:50 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=dv/xbI7f5ajYxvIo0u6wDgiCLYJqiz7RlHVIndjOhac=; b=qR2jfmq+wlgvL/5++A5V5wkoEs Omd6dgFZ8fThETbGrvbSXc2/v6fe1dnnhGtOeEXWWkDi/E7DkYYgqzbQORZwzoY68YrcIfF0FR7Qp F/XJuBNJdbyFAvXqw1RNh2EZUXTlJXpAMbJDJ1SCUpWa5Qe6PD0fhhGHNfIg6gVlANZp4dL7RlqGZ O1cpVU9LivlgyFDltAcweRmScaDZauUhmIBD09KfmbJI0WoykRXAun2G0pw/y/W49/FNl6xFxPyK/ Rfh8H9lOrddt1qlqod2CzoU3hPNpth2vADWKH1AvhKvworj0WCsWEGZMmQ9ZXIcLk9lQzJivjfn4U xoFVmW9g==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fBiAZ-0001dA-0w; Thu, 26 Apr 2018 14:46:47 +0000 Received: from out2-smtp.messagingengine.com ([66.111.4.26]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fBhtP-0007ha-Tu; Thu, 26 Apr 2018 14:29:15 +0000 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id 7704121A99; Thu, 26 Apr 2018 10:28:52 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Thu, 26 Apr 2018 10:28:52 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sent.com; h=cc :date:from:in-reply-to:message-id:references:subject:to :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; bh=Vs6h/FXwmC/ZemDkg 6BllSD/iPIPYBxFm6GunQ/1FCI=; b=tbbKn+qfrR6XErFy7CWHrU36RjD3gECJO Jh3COntEsySGV5tHBtcpR7nvugmfnECRoftz8QYpurkeBEArKAlWlgMc13y/5W7b k3uFSnbBSySvGvDfrA1pLMJmcdMKxD15MnYxfVqQPI/FCPqHLTEa7SEl/5RKdKIm hCgU2wvHniN7h+rwehdZyLfkUlmiUCw6PD0Q2tLVZ6CzSH+P43IOCsKdFDrepnL9 toAnA6Df5Flg7qkdQ3HT77ub252vbKdPQkE3rKgptwXZ/E+eDE6NwvcdVljmHPYi 5RfmKJiClVAucVxLTq1qTYvSOsCwlK1GeWweidi5LYXzRhU6RpPgg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; bh=Vs6h/FXwmC/ZemDkg6BllSD/iPIPYBxFm6GunQ/1FCI=; b=TvaKzvrF kyPOnVvyvUdCmovli7HN8cONCHg2HIuNsDmflKAaJh/M4skEEVRslxbslLjs3c7x 6UmiMfoDaTdjHDuLhix/lQ5XPjvcpvE8aRJ0Kf9y7u9VeDxDUBk40TceNpAlr5eN IQZx8qGuX8pnl6h3QU2SikDCM6nqcMH54jucBPT/nLotkdx1/7kzLrFS47ayYTm6 yWi1BgqD+/VR/Kd/JdbW/3d/9qP+sAyLb/wPZ+EGMmmKyouZzifOPuwjqKvSRHiD AQf0oOMKh6pFreo/6yb2q2My7/9iX0rPFH9w7FU6+lNSugdy74AyRKvD+Z6TWjyj saZffdehosTHwA== X-ME-Sender: Received: from tenansix.rutgers.edu (pool-165-230-225-59.nat.rutgers.edu [165.230.225.59]) by mail.messagingengine.com (Postfix) with ESMTPA id BE27FE4120; Thu, 26 Apr 2018 10:28:51 -0400 (EDT) From: Zi Yan To: linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [RFC PATCH 9/9] mm: migrate: enable thp migration for all possible architectures. Date: Thu, 26 Apr 2018 10:28:04 -0400 Message-Id: <20180426142804.180152-10-zi.yan@sent.com> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180426142804.180152-1-zi.yan@sent.com> References: <20180426142804.180152-1-zi.yan@sent.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180426_072904_232474_4C88E335 X-CRM114-Status: GOOD ( 15.80 ) X-Spam-Score: -0.8 (/) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-0.8 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [66.111.4.26 listed in list.dnswl.org] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (zi.yan[at]sent.com) -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid X-BeenThere: linux-snps-arc@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Linux on Synopsys ARC Processors List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-mips@linux-mips.org, Michal Hocko , Janosch Frank , Benjamin Herrenschmidt , Balbir Singh , Will Deacon , Paul Mackerras , sparclinux@vger.kernel.org, Thomas Gleixner , linux-s390@vger.kernel.org, Michael Ellerman , x86@kernel.org, Russell King , Ingo Molnar , Catalin Marinas , James Hogan , linux-snps-arc@lists.infradead.org, "Aneesh Kumar K.V" , Marc Zyngier , Ram Pai , "Huang, Ying" , linuxppc-dev@lists.ozlabs.org, Kristina Martsenko , Dan Williams , linux-arm-kernel@lists.infradead.org, Heiko Carstens , Steve Capper , Vineet Gupta , Ralf Baechle , Christoffer Dall , Martin Schwidefsky , Naoya Horiguchi , Zi Yan , "David S. Miller" , "Kirill A. Shutemov" MIME-Version: 1.0 Sender: "linux-snps-arc" Errors-To: linux-snps-arc-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org From: Zi Yan Remove CONFIG_ARCH_ENABLE_THP_MIGRATION. thp migration is enabled along with transparent hugepage and can be toggled via /sys/kernel/mm/transparent_hugepage/enable_thp_migration. Signed-off-by: Zi Yan Cc: linux-mm@kvack.org Cc: Vineet Gupta Cc: linux-snps-arc@lists.infradead.org Cc: Russell King Cc: Christoffer Dall Cc: Marc Zyngier Cc: linux-arm-kernel@lists.infradead.org Cc: Catalin Marinas Cc: Will Deacon Cc: Steve Capper Cc: Kristina Martsenko Cc: Dan Williams Cc: Thomas Gleixner Cc: Ingo Molnar Cc: "Kirill A. Shutemov" Cc: x86@kernel.org Cc: Ralf Baechle Cc: James Hogan Cc: Michal Hocko Cc: linux-mips@linux-mips.org Cc: Benjamin Herrenschmidt Cc: Paul Mackerras Cc: Michael Ellerman Cc: "Aneesh Kumar K.V" Cc: Ram Pai Cc: Balbir Singh Cc: Naoya Horiguchi Cc: linuxppc-dev@lists.ozlabs.org Cc: Martin Schwidefsky Cc: Heiko Carstens Cc: Janosch Frank Cc: linux-s390@vger.kernel.org Cc: "David S. Miller" Cc: sparclinux@vger.kernel.org Cc: "Huang, Ying" --- arch/x86/Kconfig | 4 ---- arch/x86/include/asm/pgtable.h | 2 -- fs/proc/task_mmu.c | 2 -- include/asm-generic/pgtable.h | 21 ++------------------- include/linux/huge_mm.h | 9 ++++----- include/linux/swapops.h | 4 +--- mm/Kconfig | 3 --- mm/huge_memory.c | 27 ++++++++++++++++++--------- mm/migrate.c | 6 ++---- mm/rmap.c | 5 ++--- 10 files changed, 29 insertions(+), 54 deletions(-) diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index 0fa71a78ec99..e73954e3eef7 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig @@ -2423,10 +2423,6 @@ config ARCH_ENABLE_HUGEPAGE_MIGRATION def_bool y depends on X86_64 && HUGETLB_PAGE && MIGRATION -config ARCH_ENABLE_THP_MIGRATION - def_bool y - depends on X86_64 && TRANSPARENT_HUGEPAGE - menu "Power management and ACPI options" config ARCH_HIBERNATION_HEADER diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h index b444d83cfc95..f9f54d9b39e3 100644 --- a/arch/x86/include/asm/pgtable.h +++ b/arch/x86/include/asm/pgtable.h @@ -1193,7 +1193,6 @@ static inline pte_t pte_swp_clear_soft_dirty(pte_t pte) return pte_clear_flags(pte, _PAGE_SWP_SOFT_DIRTY); } -#ifdef CONFIG_ARCH_ENABLE_THP_MIGRATION static inline pmd_t pmd_swp_mksoft_dirty(pmd_t pmd) { return pmd_set_flags(pmd, _PAGE_SWP_SOFT_DIRTY); @@ -1209,7 +1208,6 @@ static inline pmd_t pmd_swp_clear_soft_dirty(pmd_t pmd) return pmd_clear_flags(pmd, _PAGE_SWP_SOFT_DIRTY); } #endif -#endif #define PKRU_AD_BIT 0x1 #define PKRU_WD_BIT 0x2 diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c index dd1b2aeb01e8..07a2f028d29a 100644 --- a/fs/proc/task_mmu.c +++ b/fs/proc/task_mmu.c @@ -1326,7 +1326,6 @@ static int pagemap_pmd_range(pmd_t *pmdp, unsigned long addr, unsigned long end, frame = pmd_pfn(pmd) + ((addr & ~PMD_MASK) >> PAGE_SHIFT); } -#ifdef CONFIG_ARCH_ENABLE_THP_MIGRATION else if (is_swap_pmd(pmd)) { swp_entry_t entry = pmd_to_swp_entry(pmd); unsigned long offset = swp_offset(entry); @@ -1340,7 +1339,6 @@ static int pagemap_pmd_range(pmd_t *pmdp, unsigned long addr, unsigned long end, VM_BUG_ON(!is_pmd_migration_entry(pmd)); page = migration_entry_to_page(entry); } -#endif if (page && page_mapcount(page) == 1) flags |= PM_MMAP_EXCLUSIVE; diff --git a/include/asm-generic/pgtable.h b/include/asm-generic/pgtable.h index f59639afaa39..9dacdd203131 100644 --- a/include/asm-generic/pgtable.h +++ b/include/asm-generic/pgtable.h @@ -674,24 +674,7 @@ static inline void ptep_modify_prot_commit(struct mm_struct *mm, #define arch_start_context_switch(prev) do {} while (0) #endif -#ifdef CONFIG_HAVE_ARCH_SOFT_DIRTY -#ifndef CONFIG_ARCH_ENABLE_THP_MIGRATION -static inline pmd_t pmd_swp_mksoft_dirty(pmd_t pmd) -{ - return pmd; -} - -static inline int pmd_swp_soft_dirty(pmd_t pmd) -{ - return 0; -} - -static inline pmd_t pmd_swp_clear_soft_dirty(pmd_t pmd) -{ - return pmd; -} -#endif -#else /* !CONFIG_HAVE_ARCH_SOFT_DIRTY */ +#ifndef CONFIG_HAVE_ARCH_SOFT_DIRTY static inline int pte_soft_dirty(pte_t pte) { return 0; @@ -946,7 +929,7 @@ static inline int pmd_none_or_trans_huge_or_clear_bad(pmd_t *pmd) * redundant with !pmd_present(). */ if (pmd_none(pmdval) || pmd_trans_huge(pmdval) || - (IS_ENABLED(CONFIG_ARCH_ENABLE_THP_MIGRATION) && !pmd_present(pmdval))) + (IS_ENABLED(CONFIG_TRANSPARENT_HUGEPAGE) && !pmd_present(pmdval))) return 1; if (unlikely(pmd_bad(pmdval))) { pmd_clear_bad(pmd); diff --git a/include/linux/huge_mm.h b/include/linux/huge_mm.h index a8a126259bc4..dc3144bdb7e5 100644 --- a/include/linux/huge_mm.h +++ b/include/linux/huge_mm.h @@ -59,6 +59,7 @@ enum transparent_hugepage_flag { TRANSPARENT_HUGEPAGE_DEFRAG_REQ_MADV_FLAG, TRANSPARENT_HUGEPAGE_DEFRAG_KHUGEPAGED_FLAG, TRANSPARENT_HUGEPAGE_USE_ZERO_PAGE_FLAG, + TRANSPARENT_HUGEPAGE_MIGRATION_FLAG, #ifdef CONFIG_DEBUG_VM TRANSPARENT_HUGEPAGE_DEBUG_COW_FLAG, #endif @@ -126,6 +127,9 @@ static inline bool transparent_hugepage_enabled(struct vm_area_struct *vma) #else /* CONFIG_DEBUG_VM */ #define transparent_hugepage_debug_cow() 0 #endif /* CONFIG_DEBUG_VM */ +#define thp_migration_supported() \ + (transparent_hugepage_flags & \ + (1<pmd); } -#endif diff --git a/mm/migrate.c b/mm/migrate.c index 507cf9ba21bf..cb9c3af32614 100644 --- a/mm/migrate.c +++ b/mm/migrate.c @@ -220,14 +220,12 @@ static bool remove_migration_pte(struct page *page, struct vm_area_struct *vma, new = page - pvmw.page->index + linear_page_index(vma, pvmw.address); -#ifdef CONFIG_ARCH_ENABLE_THP_MIGRATION /* PMD-mapped THP migration entry */ - if (!pvmw.pte) { + if (IS_ENABLED(CONFIG_TRANSPARENT_HUGEPAGE) && !pvmw.pte) { VM_BUG_ON_PAGE(PageHuge(page) || !PageTransCompound(page), page); remove_migration_pmd(&pvmw, new); continue; } -#endif get_page(new); pte = pte_mkold(mk_pte(new, READ_ONCE(vma->vm_page_prot))); @@ -353,7 +351,7 @@ void migration_entry_wait_huge(struct vm_area_struct *vma, __migration_entry_wait(mm, pte, ptl); } -#ifdef CONFIG_ARCH_ENABLE_THP_MIGRATION +#ifdef CONFIG_TRANSPARENT_HUGEPAGE void pmd_migration_entry_wait(struct mm_struct *mm, pmd_t *pmd) { spinlock_t *ptl; diff --git a/mm/rmap.c b/mm/rmap.c index 8d5337fed37b..f5434f4f3e06 100644 --- a/mm/rmap.c +++ b/mm/rmap.c @@ -1369,15 +1369,14 @@ static bool try_to_unmap_one(struct page *page, struct vm_area_struct *vma, mmu_notifier_invalidate_range_start(vma->vm_mm, start, end); while (page_vma_mapped_walk(&pvmw)) { -#ifdef CONFIG_ARCH_ENABLE_THP_MIGRATION /* PMD-mapped THP migration entry */ - if (!pvmw.pte && (flags & TTU_MIGRATION)) { + if (IS_ENABLED(CONFIG_TRANSPARENT_HUGEPAGE) && + !pvmw.pte && (flags & TTU_MIGRATION)) { VM_BUG_ON_PAGE(PageHuge(page) || !PageTransCompound(page), page); set_pmd_migration_entry(&pvmw, page); continue; } -#endif /* * If the page is mlock()d, we cannot swap it out.