From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 9E8DAC433EF for ; Mon, 7 Feb 2022 01:32:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:List-Subscribe:List-Help: List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date:Subject:Cc:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=NQF/PaESSKflwz7w02uP/N/vN19f/De+dAMm/KRvSjI=; b=jZXfGoUP3iqAus kVfzXFEDGEE9IlcJGF2FPZHCBUb+hEWbb9bZ963iucf5lahceb+WQGLroVdaCtMm7/yHeauNJDlQw AC6E29vbxod0TJxuGXvMy4ZLv6YHmWF0UqAoYtMvPL2nDHzea7av5gwfIuXsD031LoTtmc4OasT1T LbZ9Cu7sl85hlCEG0vT2lxoJxrdL+uuBTA6ZtnYPmV/ISDLgl9tuogGdnUU6KZJAfgq1UeffeJqEb fx4NOH4OKvBBgo7uVYsuzEeOQgDHusXA9Solq14UF8as/w+g/rIPgiholTRCrNHVG9SfgnW52z0ll L/PoxXve+e7+rtJxYPaQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nGssH-008n9n-V7; Mon, 07 Feb 2022 01:31:26 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nGssE-008n8x-IA for linux-arm-kernel@lists.infradead.org; Mon, 07 Feb 2022 01:31:24 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id C45C36D; Sun, 6 Feb 2022 17:31:18 -0800 (PST) Received: from p8cg001049571a15.arm.com (unknown [10.163.45.31]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 15FF13F73B; Sun, 6 Feb 2022 17:31:16 -0800 (PST) From: Anshuman Khandual To: linux-arm-kernel@lists.infradead.org Cc: Anshuman Khandual , Catalin Marinas , Will Deacon , linux-kernel@vger.kernel.org Subject: [PATCH] arm64/migration: Define arm64_hugetlb_valid_size() Date: Mon, 7 Feb 2022 07:01:08 +0530 Message-Id: <1644197468-26755-1-git-send-email-anshuman.khandual@arm.com> X-Mailer: git-send-email 2.7.4 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220206_173122_687398_E3717809 X-CRM114-Status: UNSURE ( 8.64 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org arch_hugetlb_valid_size() can be just factored out to create another helper to be used in arch_hugetlb_migration_supported() as well. This just defines arm64_hugetlb_migration_supported() for that purpose. Cc: Catalin Marinas Cc: Will Deacon Cc: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Anshuman Khandual --- arch/arm64/mm/hugetlbpage.c | 27 +++++++++++---------------- 1 file changed, 11 insertions(+), 16 deletions(-) diff --git a/arch/arm64/mm/hugetlbpage.c b/arch/arm64/mm/hugetlbpage.c index ffb9c229610a..dcdc4c0c3bd8 100644 --- a/arch/arm64/mm/hugetlbpage.c +++ b/arch/arm64/mm/hugetlbpage.c @@ -56,24 +56,12 @@ void __init arm64_hugetlb_cma_reserve(void) } #endif /* CONFIG_CMA */ +static bool arm64_hugetlb_valid_size(unsigned long size); + #ifdef CONFIG_ARCH_ENABLE_HUGEPAGE_MIGRATION bool arch_hugetlb_migration_supported(struct hstate *h) { - size_t pagesize = huge_page_size(h); - - switch (pagesize) { -#ifndef __PAGETABLE_PMD_FOLDED - case PUD_SIZE: - return pud_sect_supported(); -#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; + return arm64_hugetlb_valid_size(huge_page_size(h)); } #endif @@ -504,7 +492,7 @@ static int __init hugetlbpage_init(void) } arch_initcall(hugetlbpage_init); -bool __init arch_hugetlb_valid_size(unsigned long size) +static bool arm64_hugetlb_valid_size(unsigned long size) { switch (size) { #ifndef __PAGETABLE_PMD_FOLDED @@ -517,5 +505,12 @@ bool __init arch_hugetlb_valid_size(unsigned long size) return true; } + pr_warn("%s: unrecognized huge page size 0x%lx\n", + __func__, size); return false; } + +bool __init arch_hugetlb_valid_size(unsigned long size) +{ + return arm64_hugetlb_valid_size(size); +} -- 2.20.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 51612C433F5 for ; Mon, 7 Feb 2022 01:38:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347826AbiBGBih (ORCPT ); Sun, 6 Feb 2022 20:38:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59722 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347658AbiBGBie (ORCPT ); Sun, 6 Feb 2022 20:38:34 -0500 X-Greylist: delayed 434 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Sun, 06 Feb 2022 17:38:33 PST Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 2B046C061348 for ; Sun, 6 Feb 2022 17:38:33 -0800 (PST) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id C45C36D; Sun, 6 Feb 2022 17:31:18 -0800 (PST) Received: from p8cg001049571a15.arm.com (unknown [10.163.45.31]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 15FF13F73B; Sun, 6 Feb 2022 17:31:16 -0800 (PST) From: Anshuman Khandual To: linux-arm-kernel@lists.infradead.org Cc: Anshuman Khandual , Catalin Marinas , Will Deacon , linux-kernel@vger.kernel.org Subject: [PATCH] arm64/migration: Define arm64_hugetlb_valid_size() Date: Mon, 7 Feb 2022 07:01:08 +0530 Message-Id: <1644197468-26755-1-git-send-email-anshuman.khandual@arm.com> X-Mailer: git-send-email 2.7.4 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org arch_hugetlb_valid_size() can be just factored out to create another helper to be used in arch_hugetlb_migration_supported() as well. This just defines arm64_hugetlb_migration_supported() for that purpose. Cc: Catalin Marinas Cc: Will Deacon Cc: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Anshuman Khandual --- arch/arm64/mm/hugetlbpage.c | 27 +++++++++++---------------- 1 file changed, 11 insertions(+), 16 deletions(-) diff --git a/arch/arm64/mm/hugetlbpage.c b/arch/arm64/mm/hugetlbpage.c index ffb9c229610a..dcdc4c0c3bd8 100644 --- a/arch/arm64/mm/hugetlbpage.c +++ b/arch/arm64/mm/hugetlbpage.c @@ -56,24 +56,12 @@ void __init arm64_hugetlb_cma_reserve(void) } #endif /* CONFIG_CMA */ +static bool arm64_hugetlb_valid_size(unsigned long size); + #ifdef CONFIG_ARCH_ENABLE_HUGEPAGE_MIGRATION bool arch_hugetlb_migration_supported(struct hstate *h) { - size_t pagesize = huge_page_size(h); - - switch (pagesize) { -#ifndef __PAGETABLE_PMD_FOLDED - case PUD_SIZE: - return pud_sect_supported(); -#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; + return arm64_hugetlb_valid_size(huge_page_size(h)); } #endif @@ -504,7 +492,7 @@ static int __init hugetlbpage_init(void) } arch_initcall(hugetlbpage_init); -bool __init arch_hugetlb_valid_size(unsigned long size) +static bool arm64_hugetlb_valid_size(unsigned long size) { switch (size) { #ifndef __PAGETABLE_PMD_FOLDED @@ -517,5 +505,12 @@ bool __init arch_hugetlb_valid_size(unsigned long size) return true; } + pr_warn("%s: unrecognized huge page size 0x%lx\n", + __func__, size); return false; } + +bool __init arch_hugetlb_valid_size(unsigned long size) +{ + return arm64_hugetlb_valid_size(size); +} -- 2.20.1