All of lore.kernel.org
 help / color / mirror / Atom feed
From: Catalin Marinas <catalin.marinas@arm.com>
To: Anshuman Khandual <anshuman.khandual@arm.com>
Cc: linux-arm-kernel@lists.infradead.org,
	Will Deacon <will@kernel.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] arm64/migration: Define arm64_hugetlb_valid_size()
Date: Wed, 9 Feb 2022 18:34:37 +0000	[thread overview]
Message-ID: <YgQJPVUWMruiq74O@arm.com> (raw)
In-Reply-To: <1644197468-26755-1-git-send-email-anshuman.khandual@arm.com>

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

WARNING: multiple messages have this Message-ID (diff)
From: Catalin Marinas <catalin.marinas@arm.com>
To: Anshuman Khandual <anshuman.khandual@arm.com>
Cc: linux-arm-kernel@lists.infradead.org,
	Will Deacon <will@kernel.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] arm64/migration: Define arm64_hugetlb_valid_size()
Date: Wed, 9 Feb 2022 18:34:37 +0000	[thread overview]
Message-ID: <YgQJPVUWMruiq74O@arm.com> (raw)
In-Reply-To: <1644197468-26755-1-git-send-email-anshuman.khandual@arm.com>

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

  reply	other threads:[~2022-02-09 18:35 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-07  1:31 [PATCH] arm64/migration: Define arm64_hugetlb_valid_size() Anshuman Khandual
2022-02-07  1:31 ` Anshuman Khandual
2022-02-09 18:34 ` Catalin Marinas [this message]
2022-02-09 18:34   ` Catalin Marinas
2022-02-10  4:47   ` Anshuman Khandual
2022-02-10  4:47     ` Anshuman Khandual
2022-02-10 10:42     ` Catalin Marinas
2022-02-10 10:42       ` Catalin Marinas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YgQJPVUWMruiq74O@arm.com \
    --to=catalin.marinas@arm.com \
    --cc=anshuman.khandual@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=will@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.