From patchwork Tue Oct 2 12:15:28 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anshuman Khandual X-Patchwork-Id: 10623581 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CAF47174A for ; Tue, 2 Oct 2018 12:16:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C31ED28884 for ; Tue, 2 Oct 2018 12:16:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B6F5628887; Tue, 2 Oct 2018 12:16:12 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 658D328884 for ; Tue, 2 Oct 2018 12:16:12 +0000 (UTC) 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=xdsXVz2ZpTuxND1COoAW0XGbNgCumwDIGm4CgLNURXw=; b=SrIfVnbhicadMk2KlMua9cEP6Z ML2fhTxerKqRCZW8pRbKKdTlEVEeumg7ejKMiO6NL8p/QIWu0yL6iymKCZFVMXu6fj2Qx/v6kr88+ lt1ie5taDQzOkOC3izLnuO9iQu3u24eWmb+xSQdzDRM7JHftjeXNSjJKAISm97S3PZWdlsWcENMsl i26ChkUXNlsjY7K81rcEBaHk7VTZVX3YfXraKAcPY2fzWXkGt3AWgQMA4KFcaSQjSZ++y5Qj1mrCV rJj4sfHzSGq/iPKEoWZq94tbPQWD4X+SRayvUFY/mz3OzA7gBARH2ncLueOxmUYzOkGMklHpcr0Xg SpQIO/gQ==; 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 1g7Jas-0005oM-01; Tue, 02 Oct 2018 12:16:02 +0000 Received: from foss.arm.com ([217.140.101.70]) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1g7Jal-0005kU-2D for linux-arm-kernel@lists.infradead.org; Tue, 02 Oct 2018 12:15:58 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 944D51596; Tue, 2 Oct 2018 05:15:45 -0700 (PDT) Received: from p8cg001049571a15.arm.com (unknown [10.163.1.117]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 022B53F5B7; Tue, 2 Oct 2018 05:15:41 -0700 (PDT) From: Anshuman Khandual To: linux-mm@kvack.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/4] mm/hugetlb: Enable PUD level huge page migration Date: Tue, 2 Oct 2018 17:45:28 +0530 Message-Id: <1538482531-26883-2-git-send-email-anshuman.khandual@arm.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1538482531-26883-1-git-send-email-anshuman.khandual@arm.com> References: <1538482531-26883-1-git-send-email-anshuman.khandual@arm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181002_051555_143472_C317870B X-CRM114-Status: GOOD ( 11.15 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: suzuki.poulose@arm.com, catalin.marinas@arm.com, punit.agrawal@arm.com, will.deacon@arm.com, mhocko@kernel.org, n-horiguchi@ah.jp.nec.com, Steven.Price@arm.com, mike.kravetz@oracle.com MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Architectures like arm64 have PUD level HugeTLB pages for certain configs (1GB huge page is PUD based on ARM64_4K_PAGES base page size) that can be enabled for migration. It can be achieved through checking for PUD_SHIFT order based HugeTLB pages during migration. Signed-off-by: Anshuman Khandual --- include/linux/hugetlb.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h index 6b68e34..9c1b77f 100644 --- a/include/linux/hugetlb.h +++ b/include/linux/hugetlb.h @@ -483,7 +483,8 @@ static inline bool hugepage_migration_supported(struct hstate *h) { #ifdef CONFIG_ARCH_ENABLE_HUGEPAGE_MIGRATION if ((huge_page_shift(h) == PMD_SHIFT) || - (huge_page_shift(h) == PGDIR_SHIFT)) + (huge_page_shift(h) == PUD_SHIFT) || + (huge_page_shift(h) == PGDIR_SHIFT)) return true; else return false; From patchwork Tue Oct 2 12:15:29 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anshuman Khandual X-Patchwork-Id: 10623583 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D4F2316B1 for ; Tue, 2 Oct 2018 12:16:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CE11228884 for ; Tue, 2 Oct 2018 12:16:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C1E7C28889; Tue, 2 Oct 2018 12:16:53 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id AA9FB28884 for ; Tue, 2 Oct 2018 12:16:52 +0000 (UTC) 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=SgE05jBozbqoEwv0UnhO1UZFyshXVGfqz2XQ/dBBa30=; b=YTxejvLhg/HKuG9s32uhUR37n4 GfL/7/lkh2y7HyPC2irWTSdSSUPmfhglkaQLxY4WtQDkWAIWxA0td8wnEzh0b2dhwUEy5oNmO36hT Uy7GRsGRMlqq5jNq+hX0zlLLns+bSZAOyzhdlpFzAvkBEVWJLmBxdtkzT7csT13AEGxb+TuDE/UZL zRDQn8M4JrLe4litnICJH+7cgrAyZvsJoPXpx3jwsFRBk3ZJOzsB+2/+l/zpSWAgtCIJtJqokLvDY U7NsNLgetfEgOnzDcQf6YOE7NtGqqYkbN2rI5TbqHKAl5qhnm/Rzid58U6EoHnYnSfCXH5dhVEOMk P8CJNuVA==; 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 1g7JbR-00065s-U2; Tue, 02 Oct 2018 12:16:37 +0000 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70] helo=foss.arm.com) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1g7Jak-0005kj-QH for linux-arm-kernel@lists.infradead.org; Tue, 02 Oct 2018 12:15:58 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id CA97615B2; Tue, 2 Oct 2018 05:15:49 -0700 (PDT) Received: from p8cg001049571a15.arm.com (unknown [10.163.1.117]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 2C4AD3F5B7; Tue, 2 Oct 2018 05:15:45 -0700 (PDT) From: Anshuman Khandual To: linux-mm@kvack.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/4] mm/hugetlb: Enable arch specific huge page size support for migration Date: Tue, 2 Oct 2018 17:45:29 +0530 Message-Id: <1538482531-26883-3-git-send-email-anshuman.khandual@arm.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1538482531-26883-1-git-send-email-anshuman.khandual@arm.com> References: <1538482531-26883-1-git-send-email-anshuman.khandual@arm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181002_051554_955153_7AB6BE5E X-CRM114-Status: GOOD ( 12.24 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: suzuki.poulose@arm.com, catalin.marinas@arm.com, punit.agrawal@arm.com, will.deacon@arm.com, mhocko@kernel.org, n-horiguchi@ah.jp.nec.com, Steven.Price@arm.com, mike.kravetz@oracle.com MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Architectures like arm64 have HugeTLB page sizes which are different than generic sizes at PMD, PUD, PGD level and implemented via contiguous bits. At present these special size HugeTLB pages cannot be identified through macros like (PMD|PUD|PGDIR)_SHIFT and hence chosen not be migrated. Enabling migration support for these special HugeTLB page sizes along with the generic ones (PMD|PUD|PGD) would require identifying all of them on a given platform. A platform specific hook can precisely enumerate all huge page sizes supported for migration. Instead of comparing against standard huge page orders let hugetlb_migration_support() function call a platform hook arch_hugetlb_migration_support(). Default definition for the platform hook maintains existing semantics which checks standard huge page order. But an architecture can choose to override the default and provide support for a comprehensive set of huge page sizes. Signed-off-by: Anshuman Khandual --- include/linux/hugetlb.h | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h index 9c1b77f..9df1d59 100644 --- a/include/linux/hugetlb.h +++ b/include/linux/hugetlb.h @@ -479,18 +479,29 @@ static inline pgoff_t basepage_index(struct page *page) extern int dissolve_free_huge_page(struct page *page); extern int dissolve_free_huge_pages(unsigned long start_pfn, unsigned long end_pfn); -static inline bool hugepage_migration_supported(struct hstate *h) -{ + #ifdef CONFIG_ARCH_ENABLE_HUGEPAGE_MIGRATION +#ifndef arch_hugetlb_migration_supported +static inline bool arch_hugetlb_migration_supported(struct hstate *h) +{ if ((huge_page_shift(h) == PMD_SHIFT) || (huge_page_shift(h) == PUD_SHIFT) || (huge_page_shift(h) == PGDIR_SHIFT)) return true; else return false; +} +#endif #else +static inline bool arch_hugetlb_migration_supported(struct hstate *h) +{ return false; +} #endif + +static inline bool hugepage_migration_supported(struct hstate *h) +{ + return arch_hugetlb_migration_supported(h); } static inline spinlock_t *huge_pte_lockptr(struct hstate *h, From patchwork Tue Oct 2 12:15:30 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anshuman Khandual X-Patchwork-Id: 10623591 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0BAA516B1 for ; Tue, 2 Oct 2018 12:23:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0AD7A2074F for ; Tue, 2 Oct 2018 12:23:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F050826530; Tue, 2 Oct 2018 12:23:15 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 93D452074F for ; Tue, 2 Oct 2018 12:23:15 +0000 (UTC) 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=UzsyssPljtDzMBNIj51JEoOGJeZNsh4w3rZQyyOkuKY=; b=akmhOmYMenvBwMzFSeLAS8vM4Z ntNBsZ38zr1u4UqnxGn+LTQA0k8yV/sh93gSvKcaVo41HiaYtihoybaMe76X9QTuev+xGF8K/ZoP6 TQZGdjGFBfHvNybU553zszD7D10LuLkr11gAYUksmIjkPISVp3I7H2qdGncZKYWs2x1RK5XAA4hAP aUpIrhjeOre8S2rXIM9/rVl+YReDBg+mEBtEg9aYCU8dHngg2/qnElR9uDdmBTMV5vpL5SSRGuS4v ei6sJDWkZNrC/0u1uVtW+wqqz9rIc7kRYY8NzWPPmCoVdGF0/XLiO7akYQ+cJNX6MPSV7P40una6S VJ7zJQFw==; 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 1g7Jho-0000py-Pt; Tue, 02 Oct 2018 12:23:12 +0000 Received: from foss.arm.com ([217.140.101.70]) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1g7Jal-0005lN-9F for linux-arm-kernel@lists.infradead.org; Tue, 02 Oct 2018 12:16:01 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id AC7BF15BF; Tue, 2 Oct 2018 05:15:53 -0700 (PDT) Received: from p8cg001049571a15.arm.com (unknown [10.163.1.117]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 4032A3F5B7; Tue, 2 Oct 2018 05:15:50 -0700 (PDT) From: Anshuman Khandual To: linux-mm@kvack.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 3/4] arm64/mm: Enable HugeTLB migration Date: Tue, 2 Oct 2018 17:45:30 +0530 Message-Id: <1538482531-26883-4-git-send-email-anshuman.khandual@arm.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1538482531-26883-1-git-send-email-anshuman.khandual@arm.com> References: <1538482531-26883-1-git-send-email-anshuman.khandual@arm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181002_051555_363770_FA3CEF00 X-CRM114-Status: UNSURE ( 8.71 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: suzuki.poulose@arm.com, catalin.marinas@arm.com, punit.agrawal@arm.com, will.deacon@arm.com, mhocko@kernel.org, n-horiguchi@ah.jp.nec.com, Steven.Price@arm.com, mike.kravetz@oracle.com MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Let arm64 subscribe to generic HugeTLB page migration framework. Right now this only works on the following PMD and PUD level HugeTLB page sizes with various kernel base page size combinations. CONT PTE PMD CONT PMD PUD -------- --- -------- --- 4K: NA 2M NA 1G 16K: NA 32M NA 64K: NA 512M NA Signed-off-by: Anshuman Khandual --- arch/arm64/Kconfig | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index 1b1a0e9..e54350f 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -1305,6 +1305,10 @@ config SYSVIPC_COMPAT def_bool y depends on COMPAT && SYSVIPC +config ARCH_ENABLE_HUGEPAGE_MIGRATION + def_bool y + depends on HUGETLB_PAGE && MIGRATION + menu "Power management options" source "kernel/power/Kconfig" From patchwork Tue Oct 2 12:15:31 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anshuman Khandual X-Patchwork-Id: 10623587 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DA70216B1 for ; Tue, 2 Oct 2018 12:18:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D277F28887 for ; Tue, 2 Oct 2018 12:18:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C625C2888A; Tue, 2 Oct 2018 12:18:51 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 4E57328887 for ; Tue, 2 Oct 2018 12:18:51 +0000 (UTC) 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=1HeJ/zslKzc8KP7mYr10+xfoC9/WV3ktHKHI807bE+g=; b=GqMXVDeXoiDSWzLpwVE48iZjWm fojpcshI803kN3FE70L7BHG5juH+oJS4y0LVtxAtnc10IBfj/t2//AA00vpfArv9zomgukogPZPBq jVPRJjXMqKgsaUNZegTJ/7gxaMmsFUjy+iPmXAViYqU22ce97bYGNlsYtZ4r0MfyOvWKBMZHy4Aif +Sihr6atfIe534EonjWZxXWQ3ejyrImfLEHSZqQqrB2c9xg3L50mUr73whSc3fb94LUpmCkAHizAB h6H/q137QQnvhF/uq4y1ft2HFNo/DZkft4IU1A1Gx28fW4ZEbkSmo0jEE4kXqFLJapO2OFuGyfsxk MUdPuugw==; 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 1g7JdP-0006wN-7a; Tue, 02 Oct 2018 12:18:39 +0000 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70] helo=foss.arm.com) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1g7Jay-0005nh-5c for linux-arm-kernel@lists.infradead.org; Tue, 02 Oct 2018 12:16:16 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id F34F71682; Tue, 2 Oct 2018 05:15:57 -0700 (PDT) Received: from p8cg001049571a15.arm.com (unknown [10.163.1.117]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 28E553F5B7; Tue, 2 Oct 2018 05:15:53 -0700 (PDT) From: Anshuman Khandual To: linux-mm@kvack.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 4/4] arm64/mm: Enable HugeTLB migration for contiguous bit HugeTLB pages Date: Tue, 2 Oct 2018 17:45:31 +0530 Message-Id: <1538482531-26883-5-git-send-email-anshuman.khandual@arm.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1538482531-26883-1-git-send-email-anshuman.khandual@arm.com> References: <1538482531-26883-1-git-send-email-anshuman.khandual@arm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181002_051608_269469_926FAF94 X-CRM114-Status: GOOD ( 11.14 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: suzuki.poulose@arm.com, catalin.marinas@arm.com, punit.agrawal@arm.com, will.deacon@arm.com, mhocko@kernel.org, n-horiguchi@ah.jp.nec.com, Steven.Price@arm.com, mike.kravetz@oracle.com MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Let arm64 subscribe to the previously added framework in which architecture can inform whether a given huge page size is supported for migration. This just overrides the default function arch_hugetlb_migration_supported() and enables migration for all possible HugeTLB page sizes on arm64. With this, HugeTLB migration support on arm64 now covers all possible HugeTLB options. CONT PTE PMD CONT PMD PUD -------- --- -------- --- 4K: 64K 2M 32M 1G 16K: 2M 32M 1G 64K: 2M 512M 16G Signed-off-by: Anshuman Khandual --- arch/arm64/include/asm/hugetlb.h | 5 +++++ arch/arm64/mm/hugetlbpage.c | 20 ++++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/arch/arm64/include/asm/hugetlb.h b/arch/arm64/include/asm/hugetlb.h index e73f685..656f70e 100644 --- a/arch/arm64/include/asm/hugetlb.h +++ b/arch/arm64/include/asm/hugetlb.h @@ -20,6 +20,11 @@ #include +#ifdef CONFIG_ARCH_ENABLE_HUGEPAGE_MIGRATION +#define arch_hugetlb_migration_supported arch_hugetlb_migration_supported +extern bool arch_hugetlb_migration_supported(struct hstate *h); +#endif + static inline pte_t huge_ptep_get(pte_t *ptep) { return READ_ONCE(*ptep); diff --git a/arch/arm64/mm/hugetlbpage.c b/arch/arm64/mm/hugetlbpage.c index 4eafd9f..28f4795 100644 --- a/arch/arm64/mm/hugetlbpage.c +++ b/arch/arm64/mm/hugetlbpage.c @@ -27,6 +27,26 @@ #include #include +#ifdef CONFIG_ARCH_ENABLE_HUGEPAGE_MIGRATION +bool arch_hugetlb_migration_supported(struct hstate *h) +{ + size_t pagesize = huge_page_size(h); + + switch (pagesize) { +#ifdef CONFIG_ARM64_4K_PAGES + case PUD_SIZE: +#endif + case PMD_SIZE: + case CONT_PMD_SIZE: + case CONT_PTE_SIZE: + return true; + } + pr_warn("%s: unrecognized huge page size 0x%lx\n", + __func__, pagesize); + return false; +} +#endif + int pmd_huge(pmd_t pmd) { return pmd_val(pmd) && !(pmd_val(pmd) & PMD_TABLE_BIT);