All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] arm64/migration: Define arm64_hugetlb_valid_size()
@ 2022-02-07  1:31 ` Anshuman Khandual
  0 siblings, 0 replies; 8+ messages in thread
From: Anshuman Khandual @ 2022-02-07  1:31 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: Anshuman Khandual, Catalin Marinas, Will Deacon, linux-kernel

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 <catalin.marinas@arm.com>
Cc: Will Deacon <will@kernel.org>
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
---
 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

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH] arm64/migration: Define arm64_hugetlb_valid_size()
@ 2022-02-07  1:31 ` Anshuman Khandual
  0 siblings, 0 replies; 8+ messages in thread
From: Anshuman Khandual @ 2022-02-07  1:31 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: Anshuman Khandual, Catalin Marinas, Will Deacon, linux-kernel

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 <catalin.marinas@arm.com>
Cc: Will Deacon <will@kernel.org>
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
---
 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


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH] arm64/migration: Define arm64_hugetlb_valid_size()
  2022-02-07  1:31 ` Anshuman Khandual
@ 2022-02-09 18:34   ` Catalin Marinas
  -1 siblings, 0 replies; 8+ messages in thread
From: Catalin Marinas @ 2022-02-09 18:34 UTC (permalink / raw)
  To: Anshuman Khandual; +Cc: linux-arm-kernel, Will Deacon, linux-kernel

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] arm64/migration: Define arm64_hugetlb_valid_size()
@ 2022-02-09 18:34   ` Catalin Marinas
  0 siblings, 0 replies; 8+ messages in thread
From: Catalin Marinas @ 2022-02-09 18:34 UTC (permalink / raw)
  To: Anshuman Khandual; +Cc: linux-arm-kernel, Will Deacon, linux-kernel

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] arm64/migration: Define arm64_hugetlb_valid_size()
  2022-02-09 18:34   ` Catalin Marinas
@ 2022-02-10  4:47     ` Anshuman Khandual
  -1 siblings, 0 replies; 8+ messages in thread
From: Anshuman Khandual @ 2022-02-10  4:47 UTC (permalink / raw)
  To: Catalin Marinas; +Cc: linux-arm-kernel, Will Deacon, linux-kernel



On 2/10/22 12:04 AM, Catalin Marinas wrote:
> 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.

Sure, make sense. Will change it to something like this.

bool arch_hugetlb_migration_supported(struct hstate *h)
{
        size_t pagesize = huge_page_size(h);

        if (!arm64_hugetlb_valid_size(pagesize)) {
                pr_warn("%s: unrecognized huge page size 0x%lx\n",
                        __func__, pagesize);
                return false;
        }
        return true;
}

> 
>> +
>> +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?
> 

When arch_hugetlb_migration_supported() calls arch_hugetlb_valid_size(),

With __init for arch_hugetlb_valid_size(), there is a build problem.

WARNING: modpost: vmlinux.o(.text.unlikely+0xf18): Section mismatch in
reference from the function arch_hugetlb_migration_supported() to the
function .init.text:arch_hugetlb_valid_size()
The function arch_hugetlb_migration_supported() references
the function __init arch_hugetlb_valid_size().
This is often because arch_hugetlb_migration_supported lacks a __init 
annotation or the annotation of arch_hugetlb_valid_size is wrong.

Without __init for arch_hugetlb_valid_size(), there is the same problem.

WARNING: modpost: vmlinux.o(.text.unlikely+0xf18): Section mismatch in
reference from the function arch_hugetlb_migration_supported() to the
function .init.text:arch_hugetlb_valid_size()
The function arch_hugetlb_migration_supported() references
the function __init arch_hugetlb_valid_size().
This is often because arch_hugetlb_migration_supported lacks a __init 
annotation or the annotation of arch_hugetlb_valid_size is wrong.

This might be because generic prototype for arch_hugetlb_valid_size() has
__init attribute, which arch_hugetlb_migration_supported() does not have.

Hence a local static helper arm64_hugetlb_valid_size() which both these
generic functions can call into, looked appropriate.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] arm64/migration: Define arm64_hugetlb_valid_size()
@ 2022-02-10  4:47     ` Anshuman Khandual
  0 siblings, 0 replies; 8+ messages in thread
From: Anshuman Khandual @ 2022-02-10  4:47 UTC (permalink / raw)
  To: Catalin Marinas; +Cc: linux-arm-kernel, Will Deacon, linux-kernel



On 2/10/22 12:04 AM, Catalin Marinas wrote:
> 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.

Sure, make sense. Will change it to something like this.

bool arch_hugetlb_migration_supported(struct hstate *h)
{
        size_t pagesize = huge_page_size(h);

        if (!arm64_hugetlb_valid_size(pagesize)) {
                pr_warn("%s: unrecognized huge page size 0x%lx\n",
                        __func__, pagesize);
                return false;
        }
        return true;
}

> 
>> +
>> +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?
> 

When arch_hugetlb_migration_supported() calls arch_hugetlb_valid_size(),

With __init for arch_hugetlb_valid_size(), there is a build problem.

WARNING: modpost: vmlinux.o(.text.unlikely+0xf18): Section mismatch in
reference from the function arch_hugetlb_migration_supported() to the
function .init.text:arch_hugetlb_valid_size()
The function arch_hugetlb_migration_supported() references
the function __init arch_hugetlb_valid_size().
This is often because arch_hugetlb_migration_supported lacks a __init 
annotation or the annotation of arch_hugetlb_valid_size is wrong.

Without __init for arch_hugetlb_valid_size(), there is the same problem.

WARNING: modpost: vmlinux.o(.text.unlikely+0xf18): Section mismatch in
reference from the function arch_hugetlb_migration_supported() to the
function .init.text:arch_hugetlb_valid_size()
The function arch_hugetlb_migration_supported() references
the function __init arch_hugetlb_valid_size().
This is often because arch_hugetlb_migration_supported lacks a __init 
annotation or the annotation of arch_hugetlb_valid_size is wrong.

This might be because generic prototype for arch_hugetlb_valid_size() has
__init attribute, which arch_hugetlb_migration_supported() does not have.

Hence a local static helper arm64_hugetlb_valid_size() which both these
generic functions can call into, looked appropriate.

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] arm64/migration: Define arm64_hugetlb_valid_size()
  2022-02-10  4:47     ` Anshuman Khandual
@ 2022-02-10 10:42       ` Catalin Marinas
  -1 siblings, 0 replies; 8+ messages in thread
From: Catalin Marinas @ 2022-02-10 10:42 UTC (permalink / raw)
  To: Anshuman Khandual; +Cc: linux-arm-kernel, Will Deacon, linux-kernel

On Thu, Feb 10, 2022 at 10:17:17AM +0530, Anshuman Khandual wrote:
> On 2/10/22 12:04 AM, Catalin Marinas wrote:
> > On Mon, Feb 07, 2022 at 07:01:08AM +0530, Anshuman Khandual wrote:
> >> +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?
> 
> When arch_hugetlb_migration_supported() calls arch_hugetlb_valid_size(),
> 
> With __init for arch_hugetlb_valid_size(), there is a build problem.
> 
> WARNING: modpost: vmlinux.o(.text.unlikely+0xf18): Section mismatch in
> reference from the function arch_hugetlb_migration_supported() to the
> function .init.text:arch_hugetlb_valid_size()
> The function arch_hugetlb_migration_supported() references
> the function __init arch_hugetlb_valid_size().
> This is often because arch_hugetlb_migration_supported lacks a __init 
> annotation or the annotation of arch_hugetlb_valid_size is wrong.

This is expected.

> Without __init for arch_hugetlb_valid_size(), there is the same problem.
> 
> WARNING: modpost: vmlinux.o(.text.unlikely+0xf18): Section mismatch in
> reference from the function arch_hugetlb_migration_supported() to the
> function .init.text:arch_hugetlb_valid_size()
> The function arch_hugetlb_migration_supported() references
> the function __init arch_hugetlb_valid_size().
> This is often because arch_hugetlb_migration_supported lacks a __init 
> annotation or the annotation of arch_hugetlb_valid_size is wrong.
> 
> This might be because generic prototype for arch_hugetlb_valid_size() has
> __init attribute, which arch_hugetlb_migration_supported() does not have.
> 
> Hence a local static helper arm64_hugetlb_valid_size() which both these
> generic functions can call into, looked appropriate.

Ah, I did not realise the generic prototype is __init already. So fine
by me but maybe just use __hugetlb_valid_size() as it's a local function
only (static).

-- 
Catalin

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] arm64/migration: Define arm64_hugetlb_valid_size()
@ 2022-02-10 10:42       ` Catalin Marinas
  0 siblings, 0 replies; 8+ messages in thread
From: Catalin Marinas @ 2022-02-10 10:42 UTC (permalink / raw)
  To: Anshuman Khandual; +Cc: linux-arm-kernel, Will Deacon, linux-kernel

On Thu, Feb 10, 2022 at 10:17:17AM +0530, Anshuman Khandual wrote:
> On 2/10/22 12:04 AM, Catalin Marinas wrote:
> > On Mon, Feb 07, 2022 at 07:01:08AM +0530, Anshuman Khandual wrote:
> >> +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?
> 
> When arch_hugetlb_migration_supported() calls arch_hugetlb_valid_size(),
> 
> With __init for arch_hugetlb_valid_size(), there is a build problem.
> 
> WARNING: modpost: vmlinux.o(.text.unlikely+0xf18): Section mismatch in
> reference from the function arch_hugetlb_migration_supported() to the
> function .init.text:arch_hugetlb_valid_size()
> The function arch_hugetlb_migration_supported() references
> the function __init arch_hugetlb_valid_size().
> This is often because arch_hugetlb_migration_supported lacks a __init 
> annotation or the annotation of arch_hugetlb_valid_size is wrong.

This is expected.

> Without __init for arch_hugetlb_valid_size(), there is the same problem.
> 
> WARNING: modpost: vmlinux.o(.text.unlikely+0xf18): Section mismatch in
> reference from the function arch_hugetlb_migration_supported() to the
> function .init.text:arch_hugetlb_valid_size()
> The function arch_hugetlb_migration_supported() references
> the function __init arch_hugetlb_valid_size().
> This is often because arch_hugetlb_migration_supported lacks a __init 
> annotation or the annotation of arch_hugetlb_valid_size is wrong.
> 
> This might be because generic prototype for arch_hugetlb_valid_size() has
> __init attribute, which arch_hugetlb_migration_supported() does not have.
> 
> Hence a local static helper arm64_hugetlb_valid_size() which both these
> generic functions can call into, looked appropriate.

Ah, I did not realise the generic prototype is __init already. So fine
by me but maybe just use __hugetlb_valid_size() as it's a local function
only (static).

-- 
Catalin

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2022-02-10 10:43 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
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

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.