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 8BE9BC433F5 for ; Wed, 9 Feb 2022 18:34:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239497AbiBISev (ORCPT ); Wed, 9 Feb 2022 13:34:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51878 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238982AbiBISem (ORCPT ); Wed, 9 Feb 2022 13:34:42 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EA6B9C05CB92 for ; Wed, 9 Feb 2022 10:34:43 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id A2921B82386 for ; Wed, 9 Feb 2022 18:34:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8671CC340EE; Wed, 9 Feb 2022 18:34:40 +0000 (UTC) Date: Wed, 9 Feb 2022 18:34:37 +0000 From: Catalin Marinas To: Anshuman Khandual Cc: linux-arm-kernel@lists.infradead.org, Will Deacon , linux-kernel@vger.kernel.org Subject: Re: [PATCH] arm64/migration: Define arm64_hugetlb_valid_size() Message-ID: References: <1644197468-26755-1-git-send-email-anshuman.khandual@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1644197468-26755-1-git-send-email-anshuman.khandual@arm.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Feb 07, 2022 at 07:01:08AM +0530, Anshuman Khandual wrote: > 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; > } We already have the warnings in the caller of arch_hugetlb_valid_size(), I wouldn't add another here. You can keep it in arch_hugetlb_migration_supported() though. > + > +bool __init arch_hugetlb_valid_size(unsigned long size) > +{ > + return arm64_hugetlb_valid_size(size); > +} What's wrong with keeping the arch_hugetlb_valid_size() name and just removing __init? -- Catalin 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 B6048C433EF for ; Wed, 9 Feb 2022 18:35:55 +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:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=R8dfMSD348eQsrhi8CpCpXJoeduL24KiC26rLnTMY5o=; b=brS/r5SYLY0+xW bSo6aYHjpgcXaF8eiUIMzUT/I6ZkiGnKiaNH3L03//9SmRj6ziBw2pJ/l4+AvbyIlQH+zf077Unqk a51WcCzZrEYy6HrXW4LjimeRC+BlAc546bxJyCcBB2LL8n15Y2XaQPJiKl68FsBHzFRoYYy2B3tL5 /1/FM86B6lKQ/Vsu+YfN/loLkzwOe7Kw6MS14dFyVefO5EOvLNh8Ed89MCN3bB8KOW1FaOSGquBQn LzH0chamJ64hZ9k6OFuqbFFzJzIg/twdh8uSicADLQ1CJ2ytkJvYztTv/N/obe1D1QPvWUu3mVOjc x6NE3m8RRU4YwLWB0hzg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nHrnk-0017TX-6L; Wed, 09 Feb 2022 18:34:48 +0000 Received: from dfw.source.kernel.org ([139.178.84.217]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nHrnf-0017Rz-47 for linux-arm-kernel@lists.infradead.org; Wed, 09 Feb 2022 18:34:45 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 8378261C36; Wed, 9 Feb 2022 18:34:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8671CC340EE; Wed, 9 Feb 2022 18:34:40 +0000 (UTC) Date: Wed, 9 Feb 2022 18:34:37 +0000 From: Catalin Marinas To: Anshuman Khandual Cc: linux-arm-kernel@lists.infradead.org, Will Deacon , linux-kernel@vger.kernel.org Subject: Re: [PATCH] arm64/migration: Define arm64_hugetlb_valid_size() Message-ID: References: <1644197468-26755-1-git-send-email-anshuman.khandual@arm.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1644197468-26755-1-git-send-email-anshuman.khandual@arm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220209_103443_226071_72AB84A0 X-CRM114-Status: GOOD ( 15.87 ) 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: , 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 On Mon, Feb 07, 2022 at 07:01:08AM +0530, Anshuman Khandual wrote: > 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; > } We already have the warnings in the caller of arch_hugetlb_valid_size(), I wouldn't add another here. You can keep it in arch_hugetlb_migration_supported() though. > + > +bool __init arch_hugetlb_valid_size(unsigned long size) > +{ > + return arm64_hugetlb_valid_size(size); > +} What's wrong with keeping the arch_hugetlb_valid_size() name and just removing __init? -- Catalin _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel