sparc: Use vmemmap_populate_hugepages for vmemmap_populate
Subsystems (3)
PATCH 1/1 sparc: Use vmemmap_populate_hugepages for vmemmap_populate
From: Chengkaitao <[email protected]>
1. Added the vmemmap_false_pmd function to accommodate architectures that do not support basepages.
2. In the SPARC architecture, reimplemented vmemmap_populate using vmemmap_populate_hugepages.
--- arch/sparc/mm/init_64.c | 56 ++++++++++++++++------------------------- include/linux/mm.h | 1 + mm/sparse-vmemmap.c | 7 +++++- 3 files changed, 28 insertions(+), 36 deletions(-)
arch/sparc/mm/init_64.c +21 -35
@@ -5,7 +5,7 @@* Copyright (C) 1996-1999 David S. Miller ([email protected]) * Copyright (C) 1997-1999 Jakub Jelinek ([email protected]) */ - +#include <linux/extable.h> #include <linux/kernel.h> #include <linux/sched.h>
@@ -2397,11 +2397,11 @@ void __init paging_init(void)* work. */ init_mm.pgd += ((shift) / (sizeof (pgd_t))); - +memset (swapper_pg_dir,0 ,sizeof (swapper_pg_dir));inherit_prom_mappings (); - +/* Ok, we can use our TLB miss and window trap handlers safely. */ setup_tba ();
@@ -2581,8 +2581,8 @@ unsigned long _PAGE_CACHE __read_mostly;EXPORT_SYMBOL (_PAGE_CACHE);#ifdef CONFIG_SPARSEMEM_VMEMMAP -int __meminit vmemmap_populate (unsigned long vstart,unsigned long vend, -int node,struct vmem_altmap *altmap) +void __meminit vmemmap_set_pmd (pmd_t *pmd,void *p,int node, +unsigned long addr,unsigned long next) {unsigned long pte_base;
@@ -2595,39 +2595,25 @@ int __meminit vmemmap_populate(unsigned long vstart, unsigned long vend, pte_base |= _PAGE_PMD_HUGE; - vstart = vstart &PMD_MASK ; - vend =ALIGN (vend,PMD_SIZE ); -for (; vstart < vend; vstart +=PMD_SIZE ) { -pgd_t *pgd =vmemmap_pgd_populate (vstart, node); -unsigned long pte; -p4d_t *p4d; -pud_t *pud; -pmd_t *pmd; - -if (!pgd) -return -ENOMEM ; - - p4d =vmemmap_p4d_populate (pgd, vstart, node); -if (!p4d) -return -ENOMEM ; - - pud =vmemmap_pud_populate (p4d, vstart, node); -if (!pud) -return -ENOMEM ; - - pmd =pmd_offset (pud, vstart); - pte =pmd_val (*pmd); -if (!(pte & _PAGE_VALID)) { -void *block =vmemmap_alloc_block (PMD_SIZE , node); + pmd_val(*pmd) = pte_base | __pa(p); +} -if (!block) -return -ENOMEM ; +bool __meminit vmemmap_false_pmd (pmd_t *pmd,int node) +{ +return true; +} -pmd_val (*pmd) = pte_base |__pa (block); - } - } +int __meminit vmemmap_check_pmd (pmd_t *pmdp,int node, +unsigned long addr,unsigned long next) +{ +vmemmap_verify ((pte_t *)pmdp, node, addr, next); +return 1 ; +} - return 0; +int __meminit vmemmap_populate (unsigned long vstart,unsigned long vend, +int node,struct vmem_altmap *altmap) +{ +return vmemmap_populate_hugepages (vstart, vend, node, altmap); }#endif /* CONFIG_SPARSEMEM_VMEMMAP */
include/linux/mm.h +1 -0
@@ -4248,6 +4248,7 @@ void *vmemmap_alloc_block_buf(unsigned long size, int node,void vmemmap_verify (pte_t *,int ,unsigned long ,unsigned long );void vmemmap_set_pmd (pmd_t *pmd,void *p,int node,unsigned long addr,unsigned long next); +bool vmemmap_false_pmd (pmd_t *pmd,int node);int vmemmap_check_pmd (pmd_t *pmd,int node,unsigned long addr,unsigned long next); int vmemmap_populate_basepages(unsigned long start, unsigned long end,
mm/sparse-vmemmap.c +6 -1
@@ -407,6 +407,11 @@ void __weak __meminit vmemmap_set_pmd(pmd_t *pmd, void *p, int node, { } +bool __weak __meminit vmemmap_false_pmd (pmd_t *pmd,int node) +{ +return 0 ; +} +int __weak __meminit vmemmap_check_pmd (pmd_t *pmd,int node,unsigned long addr,unsigned long next) {
@@ -446,7 +451,7 @@ int __meminit vmemmap_populate_hugepages(unsigned long start, unsigned long end,if (p) {vmemmap_set_pmd (pmd, p, node, addr, next);continue ; - }else if (altmap) { + }else if (altmap ||vmemmap_false_pmd (pmd, node)) {/* * No fallback: In any case we care about, the * altmap should be reasonably sized and aligned
Signature · 1 line
2.50.1 (Apple Git-155)
David Hildenbrand (Red Hat)
maintainerQuoted 31 lines · chengkaitao
From: Chengkaitao <[email protected]>
1. Added the
vmemmap_false_pmdfunction to accommodate architectures that do not support basepages.
2. In the SPARC architecture, reimplementedvmemmap_populateusingvmemmap_populate_hugepages.Signed-off-by Chengkaitao <[email protected]>--- arch/sparc/mm/init_64.c | 56 ++++++++++++++++------------------------- include/linux/mm.h | 1 + mm/sparse-vmemmap.c | 7 +++++- 3 files changed, 28 insertions(+), 36 deletions(-)arch/sparc/mm/init_64.c +1
-1@@ -5,7 +5,7 @@* Copyright (C) 1996-1999 David S. Miller ([email protected]) * Copyright (C) 1997-1999 Jakub Jelinek ([email protected]) */ - +#include <linux/extable.h> #include <linux/kernel.h> #include <linux/sched.h> @@ -2397,11 +2397,11 @@ void __init paging_init(void)* work. */ init_mm.pgd += ((shift) / (sizeof (pgd_t)));
arch/sparc/mm/init_64.c void __init paging_init(void) · line 2407
Quoted 10 lines
arch/sparc/mm/init_64.c +2
-2- +memset (swapper_pg_dir,0 ,sizeof (swapper_pg_dir));inherit_prom_mappings (); - +/* Ok, we can use our TLB miss and window trap handlers safely. */ setup_tba ();
Bunch of unrelated changes that should not go in here.
Quoted 84 lines
arch/sparc/mm/init_64.c +18
-32@@ -2581,8 +2581,8 @@ unsigned long _PAGE_CACHE __read_mostly;EXPORT_SYMBOL (_PAGE_CACHE);#ifdef CONFIG_SPARSEMEM_VMEMMAP -int __meminit vmemmap_populate (unsigned long vstart,unsigned long vend, -int node,struct vmem_altmap *altmap) +void __meminit vmemmap_set_pmd (pmd_t *pmd,void *p,int node, +unsigned long addr,unsigned long next) {unsigned long pte_base;@@ -2595,39 +2595,25 @@ int __meminit vmemmap_populate(unsigned long vstart, unsigned long vend, pte_base |= _PAGE_PMD_HUGE; - vstart = vstart &PMD_MASK ; - vend =ALIGN (vend,PMD_SIZE ); -for (; vstart < vend; vstart +=PMD_SIZE ) { -pgd_t *pgd =vmemmap_pgd_populate (vstart, node); -unsigned long pte; -p4d_t *p4d; -pud_t *pud; -pmd_t *pmd; - -if (!pgd) -return -ENOMEM ; - - p4d =vmemmap_p4d_populate (pgd, vstart, node); -if (!p4d) -return -ENOMEM ; - - pud =vmemmap_pud_populate (p4d, vstart, node); -if (!pud) -return -ENOMEM ; - - pmd =pmd_offset (pud, vstart); - pte =pmd_val (*pmd); -if (!(pte & _PAGE_VALID)) { -void *block =vmemmap_alloc_block (PMD_SIZE , node); + pmd_val(*pmd) = pte_base | __pa(p); +} -if (!block) -return -ENOMEM ; +bool __meminit vmemmap_false_pmd (pmd_t *pmd,int node) +{ +return true; +} -pmd_val (*pmd) = pte_base |__pa (block); - } - } +int __meminit vmemmap_check_pmd (pmd_t *pmdp,int node, +unsigned long addr,unsigned long next) +{ +vmemmap_verify ((pte_t *)pmdp, node, addr, next); +return 1 ; +} - return 0; +int __meminit vmemmap_populate (unsigned long vstart,unsigned long vend, +int node,struct vmem_altmap *altmap) +{ +return vmemmap_populate_hugepages (vstart, vend, node, altmap); }#endif /* CONFIG_SPARSEMEM_VMEMMAP */ include/linux/mm.h +1
-0@@ -4248,6 +4248,7 @@ void *vmemmap_alloc_block_buf(unsigned long size, int node,void vmemmap_verify (pte_t *,int ,unsigned long ,unsigned long );void vmemmap_set_pmd (pmd_t *pmd,void *p,int node,unsigned long addr,unsigned long next); +bool vmemmap_false_pmd (pmd_t *pmd,int node);int vmemmap_check_pmd (pmd_t *pmd,int node,unsigned long addr,unsigned long next); int vmemmap_populate_basepages(unsigned long start, unsigned long end,mm/sparse-vmemmap.c +0
-0
mm/sparse-vmemmap.c void __weak __meminit vmemmap_set_pmd(pmd_t *pmd, void *p, int node, · line 414
Quoted 8 lines
mm/sparse-vmemmap.c +5
-0@@ -407,6 +407,11 @@ void __weak __meminit vmemmap_set_pmd(pmd_t *pmd, void *p, int node, { } +bool __weak __meminit vmemmap_false_pmd (pmd_t *pmd,int node) +{ +return 0 ; +} +
Reading that function I have absolutely no clue what this is supposed to do. :)
Also, why are you passing pmd+node when sparc ignores them completely and statically returns "true" ?
If you can tell me what the semantics of that function should be, maybe we can come up with a more descriptive name.
Signature · 3 lines
Cheers David
Quoted 37 lines · David Hildenbrand (Red Hat)
Quoted 35 lines · chengkaitao
From: Chengkaitao <[email protected]>
1. Added the
vmemmap_false_pmdfunction to accommodate architectures that do not support basepages.
2. In the SPARC architecture, reimplementedvmemmap_populateusingvmemmap_populate_hugepages.Signed-off-by Chengkaitao <[email protected]>--- arch/sparc/mm/init_64.c | 56 ++++++++++++++++------------------------- include/linux/mm.h | 1 + mm/sparse-vmemmap.c | 7 +++++- 3 files changed, 28 insertions(+), 36 deletions(-)arch/sparc/mm/init_64.c +2
-2@@ -5,7 +5,7 @@* Copyright (C) 1996-1999 David S. Miller ([email protected]) * Copyright (C) 1997-1999 Jakub Jelinek ([email protected]) */ - +#include <linux/extable.h> #include <linux/kernel.h> #include <linux/sched.h> @@ -2397,11 +2397,11 @@ void __init paging_init(void)* work. */ init_mm.pgd += ((shift) / (sizeof (pgd_t))); - +memset (swapper_pg_dir,0 ,sizeof (swapper_pg_dir));
Quoted 8 lines
arch/sparc/mm/init_64.c void __init paging_init(void) · line 2407
Quoted 6 lines
arch/sparc/mm/init_64.c +1
-1inherit_prom_mappings (); - +/* Ok, we can use our TLB miss and window trap handlers safely. */ setup_tba ();Bunch of unrelated changes that should not go in here.
This indeed contains some unrelated code changes and removal of extra whitespace. These could be split into a separate patch, but the new patch might be somewhat redundant, lol. If you'd like me to proceed this way, please reply confirming.
Quoted 96 lines
Quoted 84 lines
arch/sparc/mm/init_64.c +18
-32@@ -2581,8 +2581,8 @@ unsigned long _PAGE_CACHE __read_mostly;EXPORT_SYMBOL (_PAGE_CACHE);#ifdef CONFIG_SPARSEMEM_VMEMMAP -int __meminit vmemmap_populate (unsigned long vstart,unsigned long vend, -int node,struct vmem_altmap *altmap) +void __meminit vmemmap_set_pmd (pmd_t *pmd,void *p,int node, +unsigned long addr,unsigned long next) {unsigned long pte_base;@@ -2595,39 +2595,25 @@ int __meminit vmemmap_populate(unsigned long vstart, unsigned long vend, pte_base |= _PAGE_PMD_HUGE; - vstart = vstart &PMD_MASK ; - vend =ALIGN (vend,PMD_SIZE ); -for (; vstart < vend; vstart +=PMD_SIZE ) { -pgd_t *pgd =vmemmap_pgd_populate (vstart, node); -unsigned long pte; -p4d_t *p4d; -pud_t *pud; -pmd_t *pmd; - -if (!pgd) -return -ENOMEM ; - - p4d =vmemmap_p4d_populate (pgd, vstart, node); -if (!p4d) -return -ENOMEM ; - - pud =vmemmap_pud_populate (p4d, vstart, node); -if (!pud) -return -ENOMEM ; - - pmd =pmd_offset (pud, vstart); - pte =pmd_val (*pmd); -if (!(pte & _PAGE_VALID)) { -void *block =vmemmap_alloc_block (PMD_SIZE , node); + pmd_val(*pmd) = pte_base | __pa(p); +} -if (!block) -return -ENOMEM ; +bool __meminit vmemmap_false_pmd (pmd_t *pmd,int node) +{ +return true; +} -pmd_val (*pmd) = pte_base |__pa (block); - } - } +int __meminit vmemmap_check_pmd (pmd_t *pmdp,int node, +unsigned long addr,unsigned long next) +{ +vmemmap_verify ((pte_t *)pmdp, node, addr, next); +return 1 ; +} - return 0; +int __meminit vmemmap_populate (unsigned long vstart,unsigned long vend, +int node,struct vmem_altmap *altmap) +{ +return vmemmap_populate_hugepages (vstart, vend, node, altmap); }#endif /* CONFIG_SPARSEMEM_VMEMMAP */ include/linux/mm.h +1
-0@@ -4248,6 +4248,7 @@ void *vmemmap_alloc_block_buf(unsigned long size, int node,void vmemmap_verify (pte_t *,int ,unsigned long ,unsigned long );void vmemmap_set_pmd (pmd_t *pmd,void *p,int node,unsigned long addr,unsigned long next); +bool vmemmap_false_pmd (pmd_t *pmd,int node);int vmemmap_check_pmd (pmd_t *pmd,int node,unsigned long addr,unsigned long next); int vmemmap_populate_basepages(unsigned long start, unsigned long end,mm/sparse-vmemmap.c +0
-0mm/sparse-vmemmap.c void __weak __meminit vmemmap_set_pmd(pmd_t *pmd, void *p, int node, · line 414
Quoted 8 lines
mm/sparse-vmemmap.c +5
-0@@ -407,6 +407,11 @@ void __weak __meminit vmemmap_set_pmd(pmd_t *pmd, void *p, int node, { } +bool __weak __meminit vmemmap_false_pmd (pmd_t *pmd,int node) +{ +return 0 ; +} +Reading that function I have absolutely no clue what this is supposed to do. :)
Quoted 2 lines
Also, why are you passing pmd+node when sparc ignores them completely and statically returns "true" ?
The pmd+node is indeed unnecessary. My original intention was to provide convenience for future architecture extensions, but upon reflection, this appears to be a case of over-engineering.
Quoted 2 lines
If you can tell me what the semantics of that function should be, maybe we can come up with a more descriptive name.
In the SPARC architecture, the original vmemmap_populate function does not retry with vmemmap_populate_basepages after vmemmap_alloc_block fails. I suspect SPARC doesn't support basepages, which is why we need to modify vmemmap_populate_hugepages to provide an interface that skips basepages handling.
Signature · 2 lines
Yours, Kaitao Cheng
David Hildenbrand (Red Hat)
maintainerQuoted 5 lines · Tao pilgrim
Quoted 3 lines · David Hildenbrand (Red Hat)
Quoted 1 line · chengkaitao
From: Chengkaitao <[email protected]>
^ this is the author
And you reply from a completely different address with a completely different name.
To whom am I talking here? The patch author?
[...]
Quoted 8 lines
Quoted 3 lines
Quoted 1 line
Bunch of unrelated changes that should not go in here.
This indeed contains some unrelated code changes and removal of extra whitespace. These could be split into a separate patch, but the new patch might be somewhat redundant, lol. If you'd like me to proceed this way, please reply confirming.
We usually don't do random other stuff as part of one patch. It's a different story if you touch the surrounding code, but that doesn't look like that here?
Quoted 97 lines
Quoted 97 lines
Quoted 85 lines
arch/sparc/mm/init_64.c +18
-32@@ -2581,8 +2581,8 @@ unsigned long _PAGE_CACHE __read_mostly;EXPORT_SYMBOL (_PAGE_CACHE);#ifdef CONFIG_SPARSEMEM_VMEMMAP -int __meminit vmemmap_populate (unsigned long vstart,unsigned long vend, -int node,struct vmem_altmap *altmap) +void __meminit vmemmap_set_pmd (pmd_t *pmd,void *p,int node, +unsigned long addr,unsigned long next) {unsigned long pte_base;@@ -2595,39 +2595,25 @@ int __meminit vmemmap_populate(unsigned long vstart, unsigned long vend, pte_base |= _PAGE_PMD_HUGE; - vstart = vstart &PMD_MASK ; - vend =ALIGN (vend,PMD_SIZE ); -for (; vstart < vend; vstart +=PMD_SIZE ) { -pgd_t *pgd =vmemmap_pgd_populate (vstart, node); -unsigned long pte; -p4d_t *p4d; -pud_t *pud; -pmd_t *pmd; - -if (!pgd) -return -ENOMEM ; - - p4d =vmemmap_p4d_populate (pgd, vstart, node); -if (!p4d) -return -ENOMEM ; - - pud =vmemmap_pud_populate (p4d, vstart, node); -if (!pud) -return -ENOMEM ; - - pmd =pmd_offset (pud, vstart); - pte =pmd_val (*pmd); -if (!(pte & _PAGE_VALID)) { -void *block =vmemmap_alloc_block (PMD_SIZE , node); + pmd_val(*pmd) = pte_base | __pa(p); +} -if (!block) -return -ENOMEM ; +bool __meminit vmemmap_false_pmd (pmd_t *pmd,int node) +{ +return true; +} -pmd_val (*pmd) = pte_base |__pa (block); - } - } +int __meminit vmemmap_check_pmd (pmd_t *pmdp,int node, +unsigned long addr,unsigned long next) +{ +vmemmap_verify ((pte_t *)pmdp, node, addr, next); +return 1 ; +} - return 0; +int __meminit vmemmap_populate (unsigned long vstart,unsigned long vend, +int node,struct vmem_altmap *altmap) +{ +return vmemmap_populate_hugepages (vstart, vend, node, altmap); }#endif /* CONFIG_SPARSEMEM_VMEMMAP */ include/linux/mm.h +1
-0@@ -4248,6 +4248,7 @@ void *vmemmap_alloc_block_buf(unsigned long size, int node,void vmemmap_verify (pte_t *,int ,unsigned long ,unsigned long );void vmemmap_set_pmd (pmd_t *pmd,void *p,int node,unsigned long addr,unsigned long next); +bool vmemmap_false_pmd (pmd_t *pmd,int node);int vmemmap_check_pmd (pmd_t *pmd,int node,unsigned long addr,unsigned long next); int vmemmap_populate_basepages(unsigned long start, unsigned long end,mm/sparse-vmemmap.c +0
-0mm/sparse-vmemmap.c void __weak __meminit vmemmap_set_pmd(pmd_t *pmd, void *p, int node, · line 414
Quoted 8 lines
mm/sparse-vmemmap.c +5
-0@@ -407,6 +407,11 @@ void __weak __meminit vmemmap_set_pmd(pmd_t *pmd, void *p, int node, { } +bool __weak __meminit vmemmap_false_pmd (pmd_t *pmd,int node) +{ +return 0 ; +} +Reading that function I have absolutely no clue what this is supposed to do. :)
Quoted 6 lines
Quoted 2 lines
Also, why are you passing pmd+node when sparc ignores them completely and statically returns "true" ?
The pmd+node is indeed unnecessary. My original intention was to provide convenience for future architecture extensions, but upon reflection, this appears to be a case of over-engineering.
Jup.
Quoted 10 lines
Quoted 3 lines
If you can tell me what the semantics of that function should be, maybe we can come up with a more descriptive name.
In the SPARC architecture, the original
vmemmap_populatefunction does not retry withvmemmap_populate_basepagesaftervmemmap_alloc_blockfails. I suspect SPARC doesn't support basepages, which is why we need to modifyvmemmap_populate_hugepagesto provide an interface that skips basepages handling.
So, something like vmemmap_pte_fallback_allowed() ?
Signature · 3 lines
Cheers David
Quoted 6 lines · David Hildenbrand (Red Hat)
Quoted 4 lines · Tao pilgrim
Quoted 2 lines · David Hildenbrand (Red Hat)
On 12/17/25 13:08, chengkaitao wrote:
Quoted 8 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
From: Chengkaitao <[email protected]>
^ this is the author
And you reply from a completely different address with a completely different name.
To whom am I talking here? The patch author?
Yes, I'm the author. Due to company security policies, I have to use two different email addresses, which I have no choice...
Quoted 123 lines
[...]
Quoted 6 lines
Quoted 1 line
Bunch of unrelated changes that should not go in here.
This indeed contains some unrelated code changes and removal of extra whitespace. These could be split into a separate patch, but the new patch might be somewhat redundant, lol. If you'd like me to proceed this way, please reply confirming.
We usually don't do random other stuff as part of one patch. It's a different story if you touch the surrounding code, but that doesn't look like that here?
Quoted 97 lines
Quoted 97 lines
Quoted 85 lines
arch/sparc/mm/init_64.c +18
-32@@ -2581,8 +2581,8 @@ unsigned long _PAGE_CACHE __read_mostly;EXPORT_SYMBOL (_PAGE_CACHE);#ifdef CONFIG_SPARSEMEM_VMEMMAP -int __meminit vmemmap_populate (unsigned long vstart,unsigned long vend, -int node,struct vmem_altmap *altmap) +void __meminit vmemmap_set_pmd (pmd_t *pmd,void *p,int node, +unsigned long addr,unsigned long next) {unsigned long pte_base;@@ -2595,39 +2595,25 @@ int __meminit vmemmap_populate(unsigned long vstart, unsigned long vend, pte_base |= _PAGE_PMD_HUGE; - vstart = vstart &PMD_MASK ; - vend =ALIGN (vend,PMD_SIZE ); -for (; vstart < vend; vstart +=PMD_SIZE ) { -pgd_t *pgd =vmemmap_pgd_populate (vstart, node); -unsigned long pte; -p4d_t *p4d; -pud_t *pud; -pmd_t *pmd; - -if (!pgd) -return -ENOMEM ; - - p4d =vmemmap_p4d_populate (pgd, vstart, node); -if (!p4d) -return -ENOMEM ; - - pud =vmemmap_pud_populate (p4d, vstart, node); -if (!pud) -return -ENOMEM ; - - pmd =pmd_offset (pud, vstart); - pte =pmd_val (*pmd); -if (!(pte & _PAGE_VALID)) { -void *block =vmemmap_alloc_block (PMD_SIZE , node); + pmd_val(*pmd) = pte_base | __pa(p); +} -if (!block) -return -ENOMEM ; +bool __meminit vmemmap_false_pmd (pmd_t *pmd,int node) +{ +return true; +} -pmd_val (*pmd) = pte_base |__pa (block); - } - } +int __meminit vmemmap_check_pmd (pmd_t *pmdp,int node, +unsigned long addr,unsigned long next) +{ +vmemmap_verify ((pte_t *)pmdp, node, addr, next); +return 1 ; +} - return 0; +int __meminit vmemmap_populate (unsigned long vstart,unsigned long vend, +int node,struct vmem_altmap *altmap) +{ +return vmemmap_populate_hugepages (vstart, vend, node, altmap); }#endif /* CONFIG_SPARSEMEM_VMEMMAP */ include/linux/mm.h +1
-0@@ -4248,6 +4248,7 @@ void *vmemmap_alloc_block_buf(unsigned long size, int node,void vmemmap_verify (pte_t *,int ,unsigned long ,unsigned long );void vmemmap_set_pmd (pmd_t *pmd,void *p,int node,unsigned long addr,unsigned long next); +bool vmemmap_false_pmd (pmd_t *pmd,int node);int vmemmap_check_pmd (pmd_t *pmd,int node,unsigned long addr,unsigned long next); int vmemmap_populate_basepages(unsigned long start, unsigned long end,mm/sparse-vmemmap.c +0
-0mm/sparse-vmemmap.c void __weak __meminit vmemmap_set_pmd(pmd_t *pmd, void *p, int node, · line 414
Quoted 8 lines
mm/sparse-vmemmap.c +5
-0@@ -407,6 +407,11 @@ void __weak __meminit vmemmap_set_pmd(pmd_t *pmd, void *p, int node, { } +bool __weak __meminit vmemmap_false_pmd (pmd_t *pmd,int node) +{ +return 0 ; +} +Reading that function I have absolutely no clue what this is supposed to do. :)
Quoted 6 lines
Quoted 2 lines
Also, why are you passing pmd+node when sparc ignores them completely and statically returns "true" ?
The pmd+node is indeed unnecessary. My original intention was to provide convenience for future architecture extensions, but upon reflection, this appears to be a case of over-engineering.
Jup.
Quoted 4 lines
Quoted 3 lines
If you can tell me what the semantics of that function should be, maybe we can come up with a more descriptive name.
Quoted 8 lines
Quoted 6 lines
In the SPARC architecture, the original
vmemmap_populatefunction does not retry withvmemmap_populate_basepagesaftervmemmap_alloc_blockfails. I suspect SPARC doesn't support basepages, which is why we need to modifyvmemmap_populate_hugepagesto provide an interface that skips basepages handling.So, something like
vmemmap_pte_fallback_allowed()?
LGTM!
Signature · 2 lines
Yours, Kaitao Cheng
Mike Rapoport
reviewerQuoted 6 lines · chengkaitao
From: Chengkaitao <[email protected]>
1. Added the
vmemmap_false_pmdfunction to accommodate architectures that do not support basepages.
2. In the SPARC architecture, reimplementedvmemmap_populateusingvmemmap_populate_hugepages.
What problem this patch is trying to solve?
Quoted 2 lines
Signed-off-by Chengkaitao <[email protected]>---
Signature · 2 lines
Sincerely yours, Mike.
Quoted 10 lines · Mike Rapoport
Quoted 6 lines · chengkaitao
From: Chengkaitao <[email protected]>
1. Added the
vmemmap_false_pmdfunction to accommodate architectures that do not support basepages.
2. In the SPARC architecture, reimplementedvmemmap_populateusingvmemmap_populate_hugepages.What problem this patch is trying to solve?
Following the pattern established by other architectures, vmemmap_populate is reimplemented using vmemmap_populate_hugepages in the SPARC architecture, which fulfills the intended purpose of vmemmap_populate_hugepages.
The functional logic remains unchanged.
Quoted 2 lines
Quoted 2 lines
Signed-off-by Chengkaitao <[email protected]>---
Signature · 2 lines
Yours, Kaitao Cheng
Mike Rapoport
reviewerQuoted 10 lines · Tao pilgrim
Quoted 9 lines · Mike Rapoport
Quoted 6 lines · chengkaitao
From: Chengkaitao <[email protected]>
1. Added the
vmemmap_false_pmdfunction to accommodate architectures that do not support basepages.
2. In the SPARC architecture, reimplementedvmemmap_populateusingvmemmap_populate_hugepages.
Quoted 5 lines
Quoted 1 line
What problem this patch is trying to solve?
Following the pattern established by other architectures,
vmemmap_populateis reimplemented usingvmemmap_populate_hugepagesin the SPARC architecture, which fulfills the intended purpose ofvmemmap_populate_hugepages.
But what's wrong with the current sparc::vmemmap_populate()?
Quoted 8 lines
The functional logic remains unchanged.
Quoted 2 lines
Quoted 2 lines
Signed-off-by Chengkaitao <[email protected]>---
Signature · 2 lines
Yours, Kaitao Cheng
Signature · 2 lines
Sincerely yours, Mike.
Quoted 12 lines · Mike Rapoport
Quoted 10 lines · Tao pilgrim
Quoted 9 lines · Mike Rapoport
Quoted 6 lines · chengkaitao
From: Chengkaitao <[email protected]>
1. Added the
vmemmap_false_pmdfunction to accommodate architectures that do not support basepages.
2. In the SPARC architecture, reimplementedvmemmap_populateusingvmemmap_populate_hugepages.
Quoted 7 lines
Quoted 5 lines
Quoted 1 line
What problem this patch is trying to solve?
Following the pattern established by other architectures,
vmemmap_populateis reimplemented usingvmemmap_populate_hugepagesin the SPARC architecture, which fulfills the intended purpose ofvmemmap_populate_hugepages.But what's wrong with the current
sparc::vmemmap_populate()?
The current implementation of sparc::vmemmap_populate() is correct and functional.
However, I believe that generalizing vmemmap_populate_hugepages() still results in certain architectures requiring special-case handling branches, which is contrary to our goal of a unified implementation.
Another benefit is that it allows us to eliminate the external declarations of vmemmap_p?d_populate functions and convert them to static functions.
Quoted 4 lines
Quoted 4 lines
The functional logic remains unchanged.
Quoted 2 lines
Quoted 2 lines
Signed-off-by Chengkaitao <[email protected]>---
Signature · 2 lines
Yours, Kaitao Cheng
Mike Rapoport
reviewerQuoted 24 lines · Tao pilgrim
Quoted 12 lines · Mike Rapoport
Quoted 10 lines · Tao pilgrim
Quoted 9 lines · Mike Rapoport
Quoted 6 lines · chengkaitao
From: Chengkaitao <[email protected]>
1. Added the
vmemmap_false_pmdfunction to accommodate architectures that do not support basepages.
2. In the SPARC architecture, reimplementedvmemmap_populateusingvmemmap_populate_hugepages.Quoted 7 lines
Quoted 5 lines
Quoted 1 line
What problem this patch is trying to solve?
Following the pattern established by other architectures,
vmemmap_populateis reimplemented usingvmemmap_populate_hugepagesin the SPARC architecture, which fulfills the intended purpose ofvmemmap_populate_hugepages.But what's wrong with the current
sparc::vmemmap_populate()?The current implementation of
sparc::vmemmap_populate()is correct and functional.
Quoted 7 lines
However, I believe that generalizing
vmemmap_populate_hugepages()still results in certain architectures requiring special-case handling branches, which is contrary to our goal of a unified implementation.Another benefit is that it allows us to eliminate the external declarations of vmemmap_p?d_populate functions and convert them to static functions.
If the goals are to provide a unified implementation and eliminate the external declarations of vmemmap_p?d_populate() functions, I'd suggest to send all this a single series rather than a single patch that updates sparc implementation.
Regarding the ability of sparc to fallback to vmemmap_populate_basepages(), it does not seem to me that this is an architectural limitation. sparc uses base pages in the kernel page tables, so it should be able to use them in vmemmap as well.
Quoted 8 lines
Quoted 4 lines
Quoted 4 lines
The functional logic remains unchanged.
Quoted 2 lines
Quoted 2 lines
Signed-off-by Chengkaitao <[email protected]>---
Signature · 2 lines
Yours, Kaitao Cheng
Signature · 2 lines
Sincerely yours, Mike.
Quoted 39 lines · Mike Rapoport
Quoted 24 lines · Tao pilgrim
Quoted 12 lines · Mike Rapoport
Quoted 10 lines · Tao pilgrim
Quoted 9 lines · Mike Rapoport
Quoted 6 lines · chengkaitao
From: Chengkaitao <[email protected]>
1. Added the
vmemmap_false_pmdfunction to accommodate architectures that do not support basepages.
2. In the SPARC architecture, reimplementedvmemmap_populateusingvmemmap_populate_hugepages.Quoted 7 lines
Quoted 5 lines
Quoted 1 line
What problem this patch is trying to solve?
Following the pattern established by other architectures,
vmemmap_populateis reimplemented usingvmemmap_populate_hugepagesin the SPARC architecture, which fulfills the intended purpose ofvmemmap_populate_hugepages.But what's wrong with the current
sparc::vmemmap_populate()?The current implementation of
sparc::vmemmap_populate()is correct and functional.Quoted 7 lines
However, I believe that generalizing
vmemmap_populate_hugepages()still results in certain architectures requiring special-case handling branches, which is contrary to our goal of a unified implementation.Another benefit is that it allows us to eliminate the external declarations of vmemmap_p?d_populate functions and convert them to static functions.
If the goals are to provide a unified implementation and eliminate the external declarations of vmemmap_p?d_populate() functions, I'd suggest to send all this a single series rather than a single patch that updates sparc implementation.
Quoted 4 lines
Regarding the ability of sparc to fallback to
vmemmap_populate_basepages(), it does not seem to me that this is an architectural limitation. sparc uses base pages in the kernel page tables, so it should be able to use them in vmemmap as well.
If SPARC can use base pages in vmemmap, I might remove the vmemmap_false_pmd implementation. Thanks for your review.
Quoted 5 lines
Quoted 5 lines
Quoted 4 lines
Quoted 4 lines
The functional logic remains unchanged.
Quoted 2 lines
Quoted 2 lines
Signed-off-by Chengkaitao <[email protected]>---
Signature · 2 lines
Yours, Kaitao Cheng