* [PATCH V2] arm64/hugetlb: Define __hugetlb_valid_size()
@ 2022-02-10 11:16 Anshuman Khandual
2022-02-10 11:22 ` Catalin Marinas
2022-02-15 16:48 ` Will Deacon
0 siblings, 2 replies; 6+ messages in thread
From: Anshuman Khandual @ 2022-02-10 11:16 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
__hugetlb_valid_size() 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>
---
This applies on v5.17-rc3
Changes in V2:
- s/arm64_hugetlb_valid_size/__hugetlb_valid_size per Catalin
- Restored back warning in arch_hugetlb_migration_supported() per Catalin
- Updated the commit message subject line as required
Changes in V1:
https://lore.kernel.org/all/1644197468-26755-1-git-send-email-anshuman.khandual@arm.com/
arch/arm64/mm/hugetlbpage.c | 26 +++++++++++++-------------
1 file changed, 13 insertions(+), 13 deletions(-)
diff --git a/arch/arm64/mm/hugetlbpage.c b/arch/arm64/mm/hugetlbpage.c
index ffb9c229610a..72ed07fe2c84 100644
--- a/arch/arm64/mm/hugetlbpage.c
+++ b/arch/arm64/mm/hugetlbpage.c
@@ -56,24 +56,19 @@ void __init arm64_hugetlb_cma_reserve(void)
}
#endif /* CONFIG_CMA */
+static bool __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",
+ if (!__hugetlb_valid_size(pagesize)) {
+ pr_warn("%s: unrecognized huge page size 0x%lx\n",
__func__, pagesize);
- return false;
+ return false;
+ }
+ return true;
}
#endif
@@ -504,7 +499,7 @@ static int __init hugetlbpage_init(void)
}
arch_initcall(hugetlbpage_init);
-bool __init arch_hugetlb_valid_size(unsigned long size)
+static bool __hugetlb_valid_size(unsigned long size)
{
switch (size) {
#ifndef __PAGETABLE_PMD_FOLDED
@@ -519,3 +514,8 @@ bool __init arch_hugetlb_valid_size(unsigned long size)
return false;
}
+
+bool __init arch_hugetlb_valid_size(unsigned long size)
+{
+ return __hugetlb_valid_size(size);
+}
--
2.20.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH V2] arm64/hugetlb: Define __hugetlb_valid_size()
2022-02-10 11:16 [PATCH V2] arm64/hugetlb: Define __hugetlb_valid_size() Anshuman Khandual
@ 2022-02-10 11:22 ` Catalin Marinas
2022-02-15 16:48 ` Will Deacon
1 sibling, 0 replies; 6+ messages in thread
From: Catalin Marinas @ 2022-02-10 11:22 UTC (permalink / raw)
To: Anshuman Khandual; +Cc: linux-arm-kernel, Will Deacon, linux-kernel
On Thu, Feb 10, 2022 at 04:46:10PM +0530, Anshuman Khandual wrote:
> 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
> __hugetlb_valid_size() 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>
Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH V2] arm64/hugetlb: Define __hugetlb_valid_size()
2022-02-10 11:16 [PATCH V2] arm64/hugetlb: Define __hugetlb_valid_size() Anshuman Khandual
2022-02-10 11:22 ` Catalin Marinas
@ 2022-02-15 16:48 ` Will Deacon
2022-02-15 23:39 ` Anshuman Khandual
1 sibling, 1 reply; 6+ messages in thread
From: Will Deacon @ 2022-02-15 16:48 UTC (permalink / raw)
To: Anshuman Khandual; +Cc: linux-arm-kernel, Catalin Marinas, linux-kernel
On Thu, Feb 10, 2022 at 04:46:10PM +0530, Anshuman Khandual wrote:
> 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
> __hugetlb_valid_size() 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>
> ---
> This applies on v5.17-rc3
>
> Changes in V2:
>
> - s/arm64_hugetlb_valid_size/__hugetlb_valid_size per Catalin
> - Restored back warning in arch_hugetlb_migration_supported() per Catalin
> - Updated the commit message subject line as required
>
> Changes in V1:
>
> https://lore.kernel.org/all/1644197468-26755-1-git-send-email-anshuman.khandual@arm.com/
>
> arch/arm64/mm/hugetlbpage.c | 26 +++++++++++++-------------
> 1 file changed, 13 insertions(+), 13 deletions(-)
>
> diff --git a/arch/arm64/mm/hugetlbpage.c b/arch/arm64/mm/hugetlbpage.c
> index ffb9c229610a..72ed07fe2c84 100644
> --- a/arch/arm64/mm/hugetlbpage.c
> +++ b/arch/arm64/mm/hugetlbpage.c
> @@ -56,24 +56,19 @@ void __init arm64_hugetlb_cma_reserve(void)
> }
> #endif /* CONFIG_CMA */
>
> +static bool __hugetlb_valid_size(unsigned long size);
Why not reorder the code to avoid this forward declaration?
Will
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH V2] arm64/hugetlb: Define __hugetlb_valid_size()
2022-02-15 16:48 ` Will Deacon
@ 2022-02-15 23:39 ` Anshuman Khandual
2022-02-16 12:30 ` Will Deacon
0 siblings, 1 reply; 6+ messages in thread
From: Anshuman Khandual @ 2022-02-15 23:39 UTC (permalink / raw)
To: Will Deacon; +Cc: linux-arm-kernel, Catalin Marinas, linux-kernel
On 2/15/22 10:18 PM, Will Deacon wrote:
> On Thu, Feb 10, 2022 at 04:46:10PM +0530, Anshuman Khandual wrote:
>> 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
>> __hugetlb_valid_size() 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>
>> ---
>> This applies on v5.17-rc3
>>
>> Changes in V2:
>>
>> - s/arm64_hugetlb_valid_size/__hugetlb_valid_size per Catalin
>> - Restored back warning in arch_hugetlb_migration_supported() per Catalin
>> - Updated the commit message subject line as required
>>
>> Changes in V1:
>>
>> https://lore.kernel.org/all/1644197468-26755-1-git-send-email-anshuman.khandual@arm.com/
>>
>> arch/arm64/mm/hugetlbpage.c | 26 +++++++++++++-------------
>> 1 file changed, 13 insertions(+), 13 deletions(-)
>>
>> diff --git a/arch/arm64/mm/hugetlbpage.c b/arch/arm64/mm/hugetlbpage.c
>> index ffb9c229610a..72ed07fe2c84 100644
>> --- a/arch/arm64/mm/hugetlbpage.c
>> +++ b/arch/arm64/mm/hugetlbpage.c
>> @@ -56,24 +56,19 @@ void __init arm64_hugetlb_cma_reserve(void)
>> }
>> #endif /* CONFIG_CMA */
>>
>> +static bool __hugetlb_valid_size(unsigned long size);
>
> Why not reorder the code to avoid this forward declaration?
That will create more code churn, which I tried to avoid.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH V2] arm64/hugetlb: Define __hugetlb_valid_size()
2022-02-15 23:39 ` Anshuman Khandual
@ 2022-02-16 12:30 ` Will Deacon
2022-02-17 4:17 ` Anshuman Khandual
0 siblings, 1 reply; 6+ messages in thread
From: Will Deacon @ 2022-02-16 12:30 UTC (permalink / raw)
To: Anshuman Khandual; +Cc: linux-arm-kernel, Catalin Marinas, linux-kernel
On Wed, Feb 16, 2022 at 05:09:12AM +0530, Anshuman Khandual wrote:
>
>
> On 2/15/22 10:18 PM, Will Deacon wrote:
> > On Thu, Feb 10, 2022 at 04:46:10PM +0530, Anshuman Khandual wrote:
> >> 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
> >> __hugetlb_valid_size() 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>
> >> ---
> >> This applies on v5.17-rc3
> >>
> >> Changes in V2:
> >>
> >> - s/arm64_hugetlb_valid_size/__hugetlb_valid_size per Catalin
> >> - Restored back warning in arch_hugetlb_migration_supported() per Catalin
> >> - Updated the commit message subject line as required
> >>
> >> Changes in V1:
> >>
> >> https://lore.kernel.org/all/1644197468-26755-1-git-send-email-anshuman.khandual@arm.com/
> >>
> >> arch/arm64/mm/hugetlbpage.c | 26 +++++++++++++-------------
> >> 1 file changed, 13 insertions(+), 13 deletions(-)
> >>
> >> diff --git a/arch/arm64/mm/hugetlbpage.c b/arch/arm64/mm/hugetlbpage.c
> >> index ffb9c229610a..72ed07fe2c84 100644
> >> --- a/arch/arm64/mm/hugetlbpage.c
> >> +++ b/arch/arm64/mm/hugetlbpage.c
> >> @@ -56,24 +56,19 @@ void __init arm64_hugetlb_cma_reserve(void)
> >> }
> >> #endif /* CONFIG_CMA */
> >>
> >> +static bool __hugetlb_valid_size(unsigned long size);
> >
> > Why not reorder the code to avoid this forward declaration?
>
> That will create more code churn, which I tried to avoid.
Isn't it just moving a handful of lines further up in the file? What's
the problem with that?
Will
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH V2] arm64/hugetlb: Define __hugetlb_valid_size()
2022-02-16 12:30 ` Will Deacon
@ 2022-02-17 4:17 ` Anshuman Khandual
0 siblings, 0 replies; 6+ messages in thread
From: Anshuman Khandual @ 2022-02-17 4:17 UTC (permalink / raw)
To: Will Deacon; +Cc: linux-arm-kernel, Catalin Marinas, linux-kernel
On 2/16/22 6:00 PM, Will Deacon wrote:
> On Wed, Feb 16, 2022 at 05:09:12AM +0530, Anshuman Khandual wrote:
>>
>>
>> On 2/15/22 10:18 PM, Will Deacon wrote:
>>> On Thu, Feb 10, 2022 at 04:46:10PM +0530, Anshuman Khandual wrote:
>>>> 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
>>>> __hugetlb_valid_size() 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>
>>>> ---
>>>> This applies on v5.17-rc3
>>>>
>>>> Changes in V2:
>>>>
>>>> - s/arm64_hugetlb_valid_size/__hugetlb_valid_size per Catalin
>>>> - Restored back warning in arch_hugetlb_migration_supported() per Catalin
>>>> - Updated the commit message subject line as required
>>>>
>>>> Changes in V1:
>>>>
>>>> https://lore.kernel.org/all/1644197468-26755-1-git-send-email-anshuman.khandual@arm.com/
>>>>
>>>> arch/arm64/mm/hugetlbpage.c | 26 +++++++++++++-------------
>>>> 1 file changed, 13 insertions(+), 13 deletions(-)
>>>>
>>>> diff --git a/arch/arm64/mm/hugetlbpage.c b/arch/arm64/mm/hugetlbpage.c
>>>> index ffb9c229610a..72ed07fe2c84 100644
>>>> --- a/arch/arm64/mm/hugetlbpage.c
>>>> +++ b/arch/arm64/mm/hugetlbpage.c
>>>> @@ -56,24 +56,19 @@ void __init arm64_hugetlb_cma_reserve(void)
>>>> }
>>>> #endif /* CONFIG_CMA */
>>>>
>>>> +static bool __hugetlb_valid_size(unsigned long size);
>>>
>>> Why not reorder the code to avoid this forward declaration?
>>
>> That will create more code churn, which I tried to avoid.
>
> Isn't it just moving a handful of lines further up in the file? What's
> the problem with that?
No problem as such, will change and resend.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2022-02-17 4:17 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-10 11:16 [PATCH V2] arm64/hugetlb: Define __hugetlb_valid_size() Anshuman Khandual
2022-02-10 11:22 ` Catalin Marinas
2022-02-15 16:48 ` Will Deacon
2022-02-15 23:39 ` Anshuman Khandual
2022-02-16 12:30 ` Will Deacon
2022-02-17 4:17 ` Anshuman Khandual
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).