diff mbox series

[v4,04/13] mm/vmemmap: Allow architectures to override how vmemmap optimization works

Message ID 20230710160842.56300-5-aneesh.kumar@linux.ibm.com (mailing list archive)
State New
Headers show
Series Add support for DAX vmemmap optimization for ppc64 | expand

Commit Message

Aneesh Kumar K.V July 10, 2023, 4:08 p.m. UTC
Architectures like powerpc will like to use different page table allocators
and mapping mechanisms to implement vmemmap optimization. Similar to
vmemmap_populate allow architectures to implement
vmemap_populate_compound_pages

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
---
 mm/sparse-vmemmap.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Christophe Leroy July 10, 2023, 5:26 p.m. UTC | #1
Le 10/07/2023 à 18:08, Aneesh Kumar K.V a écrit :
> Architectures like powerpc will like to use different page table allocators
> and mapping mechanisms to implement vmemmap optimization. Similar to
> vmemmap_populate allow architectures to implement
> vmemap_populate_compound_pages
> 
> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
> ---
>   mm/sparse-vmemmap.c | 3 +++
>   1 file changed, 3 insertions(+)
> 
> diff --git a/mm/sparse-vmemmap.c b/mm/sparse-vmemmap.c
> index a044a130405b..541b3f69a481 100644
> --- a/mm/sparse-vmemmap.c
> +++ b/mm/sparse-vmemmap.c
> @@ -141,6 +141,7 @@ void __meminit vmemmap_verify(pte_t *pte, int node,
>   			start, end - 1);
>   }
>   
> +#ifndef vmemmap_populate_compound_pages
>   pte_t * __meminit vmemmap_pte_populate(pmd_t *pmd, unsigned long addr, int node,
>   				       struct vmem_altmap *altmap,
>   				       struct page *reuse)

Should vmemmap_pte_populate() be static ?

It looks odd to exclude a non-static function based on a non related macro.

There are several such function in the block being excluded here. Can 
you explain why it is correct to do that ?

> @@ -446,6 +447,8 @@ static int __meminit vmemmap_populate_compound_pages(unsigned long start_pfn,
>   	return 0;
>   }
>   
> +#endif
> +
>   struct page * __meminit __populate_section_memmap(unsigned long pfn,
>   		unsigned long nr_pages, int nid, struct vmem_altmap *altmap,
>   		struct dev_pagemap *pgmap)
Aneesh Kumar K.V July 11, 2023, 4:27 a.m. UTC | #2
Christophe Leroy <christophe.leroy@csgroup.eu> writes:

> Le 10/07/2023 à 18:08, Aneesh Kumar K.V a écrit :
>> Architectures like powerpc will like to use different page table allocators
>> and mapping mechanisms to implement vmemmap optimization. Similar to
>> vmemmap_populate allow architectures to implement
>> vmemap_populate_compound_pages
>> 
>> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
>> ---
>>   mm/sparse-vmemmap.c | 3 +++
>>   1 file changed, 3 insertions(+)
>> 
>> diff --git a/mm/sparse-vmemmap.c b/mm/sparse-vmemmap.c
>> index a044a130405b..541b3f69a481 100644
>> --- a/mm/sparse-vmemmap.c
>> +++ b/mm/sparse-vmemmap.c
>> @@ -141,6 +141,7 @@ void __meminit vmemmap_verify(pte_t *pte, int node,
>>   			start, end - 1);
>>   }
>>   
>> +#ifndef vmemmap_populate_compound_pages
>>   pte_t * __meminit vmemmap_pte_populate(pmd_t *pmd, unsigned long addr, int node,
>>   				       struct vmem_altmap *altmap,
>>   				       struct page *reuse)
>
> Should vmemmap_pte_populate() be static ?
>
> It looks odd to exclude a non-static function based on a non related macro.
>
> There are several such function in the block being excluded here. Can 
> you explain why it is correct to do that ?
>


Those functions can actually be made static. But I will do that as a
part of different patch. I will update this patch and make sure the
 #ifdef will only override the vmemmap_populate_compound_pages.

modified   mm/sparse-vmemmap.c
@@ -141,7 +141,6 @@ void __meminit vmemmap_verify(pte_t *pte, int node,
			start, end - 1);
 }

-#ifndef vmemmap_populate_compound_pages
 pte_t * __meminit vmemmap_pte_populate(pmd_t *pmd, unsigned long addr, int node,
				       struct vmem_altmap *altmap,
				       struct page *reuse)
@@ -359,6 +358,7 @@ int __meminit vmemmap_populate_hugepages(unsigned long start, unsigned long end,
	return 0;
 }

+#ifndef vmemmap_populate_compound_pages
 /*
  * For compound pages bigger than section size (e.g. x86 1G compound
  * pages with 2M subsection size) fill the rest of sections as tail

-aneesh
diff mbox series

Patch

diff --git a/mm/sparse-vmemmap.c b/mm/sparse-vmemmap.c
index a044a130405b..541b3f69a481 100644
--- a/mm/sparse-vmemmap.c
+++ b/mm/sparse-vmemmap.c
@@ -141,6 +141,7 @@  void __meminit vmemmap_verify(pte_t *pte, int node,
 			start, end - 1);
 }
 
+#ifndef vmemmap_populate_compound_pages
 pte_t * __meminit vmemmap_pte_populate(pmd_t *pmd, unsigned long addr, int node,
 				       struct vmem_altmap *altmap,
 				       struct page *reuse)
@@ -446,6 +447,8 @@  static int __meminit vmemmap_populate_compound_pages(unsigned long start_pfn,
 	return 0;
 }
 
+#endif
+
 struct page * __meminit __populate_section_memmap(unsigned long pfn,
 		unsigned long nr_pages, int nid, struct vmem_altmap *altmap,
 		struct dev_pagemap *pgmap)