From patchwork Thu Apr 26 14:27:55 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zi Yan X-Patchwork-Id: 905100 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40X08w0vr6z9ryr for ; Fri, 27 Apr 2018 00:40:16 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=sent.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=sent.com header.i=@sent.com header.b="G3elfgiA"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="OytRFPk8"; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 40X08v5zLGzF24q for ; Fri, 27 Apr 2018 00:40:15 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=sent.com Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=sent.com header.i=@sent.com header.b="G3elfgiA"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="OytRFPk8"; dkim-atps=neutral X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=sent.com (client-ip=66.111.4.26; helo=out2-smtp.messagingengine.com; envelope-from=zi.yan@sent.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=sent.com Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=sent.com header.i=@sent.com header.b="G3elfgiA"; dkim=pass (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="OytRFPk8"; dkim-atps=neutral X-Greylist: delayed 554 seconds by postgrey-1.36 at bilbo; Fri, 27 Apr 2018 00:38:14 AEST Received: from out2-smtp.messagingengine.com (out2-smtp.messagingengine.com [66.111.4.26]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 40X06Z1gmCzF24j for ; Fri, 27 Apr 2018 00:38:14 +1000 (AEST) Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id BE320218C7; 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:message-id:subject:to:x-me-sender:x-me-sender :x-sasl-enc; s=fm3; bh=E3PNGaPY3F0M0e8EkFenEXv92XVCiiZdXpeNhL1n9 G0=; b=G3elfgiAVIAQADB3Holant1pjyQ0HgJAuXhfbp3RGMNt3jMbTLj74Gp5h SAY0YFHwxlHKX4lX33f/V1gwDZmjoI3QaowuG5sxvxJFXfpvmcpWe7l631GilvD9 0Pdo8SQx0zdUYHn+udcBAjfu9e2Bvo+jKIDtliQlZe63W8iy88nEpwbib9DftQ9d tKMNABXcwcJvLjnO8U6Vb/xMlkOB2T+9XaEnX7Gpg9IBLfthfT1lKwTSnmwnIkJR LJxGiq8yYtrb+poUNKulgOFAz28/lyIADdBMNpa7nsfamIE4lutSXqU3Z35Li/1x htuV2yvgCJDKkCS/9YCzzmDZrG5xQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:message-id:subject:to :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=E3PNGaPY3F0M0e8Ek FenEXv92XVCiiZdXpeNhL1n9G0=; b=OytRFPk8rOxxkB++nXDW3NokaFEl8FUP6 jiyQLwhpB8ilytZ7tQURo10iTrDSB+ZjU+Cgz6u2St3QWCHyZLaq0Bk9jfPJl6If il1JmId59kLXWBoSnWpjDCo2EieFzSGPOpSUQmtnPEdE/FwVQH/vsibNLJ30Hoh9 jVH82CCMhQROxZdW+B2GQI6ytiLauGGs7ebBbolmgTxN/QKkZV8nPB9ursnlslYe iqpWtakGarexifNBQO/PexJ5cRS1PyVycBxp+xxsK/Xp6QOOgbr/PYvFLrzCDjEu 4bUSwja1/4FvNvSNMhUZ4AsZiIQPvpUa9VWT3tl1O6/diAahF6i2g== 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 E9CB7E47A0; Thu, 26 Apr 2018 10:28:49 -0400 (EDT) From: Zi Yan To: linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [RFC PATCH 0/9] Enable THP migration for all possible architectures Date: Thu, 26 Apr 2018 10:27:55 -0400 Message-Id: <20180426142804.180152-1-zi.yan@sent.com> X-Mailer: git-send-email 2.17.0 X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-mips@linux-mips.org, Michal Hocko , Janosch Frank , Will Deacon , Paul Mackerras , sparclinux@vger.kernel.org, Thomas Gleixner , linux-s390@vger.kernel.org, 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" Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" From: Zi Yan Hi all, THP migration is only enabled on x86_64 with a special ARCH_ENABLE_THP_MIGRATION macro. This patchset enables THP migration for all architectures that uses transparent hugepage, so that special macro can be dropped. Instead, THP migration is enabled/disabled via /sys/kernel/mm/transparent_hugepage/enable_thp_migration. I grepped for TRANSPARENT_HUGEPAGE in arch folder and got 9 architectures that are supporting transparent hugepage. I mechanically add __pmd_to_swp_entry() and __swp_entry_to_pmd() based on existing __pte_to_swp_entry() and __swp_entry_to_pte() for all these architectures, except tile which is going to be dropped. I have successfully compiled all these architectures, but have NOT tested them due to lack of real hardware. I appreciate your help, if the maintainers of these architectures can do a quick test with the code from https://github.com/x-y-z/thp-migration-bench . Please apply patch 9 as well to enable THP migration. By enabling THP migration, migrating a 2MB THP on x86_64 machines takes only 1/3 time of migrating equivalent 512 4KB pages. Hi Naoya, I also add soft dirty support for powerpc and s390. It would be great if you can take a look at patch 6 & 7. Feel free to give comments. Thanks. 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" Zi Yan (9): arc: mm: migrate: add pmd swap entry to support thp migration. arm: mm: migrate: add pmd swap entry to support thp migration. arm64: mm: migrate: add pmd swap entry to support thp migration. i386: mm: migrate: add pmd swap entry to support thp migration. mips: mm: migrate: add pmd swap entry to support thp migration. powerpc: mm: migrate: add pmd swap entry to support thp migration. s390: mm: migrate: add pmd swap entry to support thp migration. sparc: mm: migrate: add pmd swap entry to support thp migration. mm: migrate: enable thp migration for all possible architectures. arch/arc/include/asm/pgtable.h | 2 ++ arch/arm/include/asm/pgtable.h | 2 ++ arch/arm64/include/asm/pgtable.h | 2 ++ arch/mips/include/asm/pgtable-64.h | 2 ++ arch/powerpc/include/asm/book3s/32/pgtable.h | 2 ++ arch/powerpc/include/asm/book3s/64/pgtable.h | 17 ++++++++++++ arch/powerpc/include/asm/nohash/32/pgtable.h | 2 ++ arch/powerpc/include/asm/nohash/64/pgtable.h | 2 ++ arch/s390/include/asm/pgtable.h | 5 ++++ arch/sparc/include/asm/pgtable_32.h | 2 ++ arch/sparc/include/asm/pgtable_64.h | 2 ++ arch/x86/Kconfig | 4 --- arch/x86/include/asm/pgtable-2level.h | 2 ++ arch/x86/include/asm/pgtable-3level.h | 2 ++ 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 ++-- 23 files changed, 73 insertions(+), 54 deletions(-)