powerpc/mm: Rename variable to reflect start address of a section
RFC 1/4 powerpc/mm: Rename variable to reflect start address of a section
The commit (16a05bff1: powerpc: start loop at section start of start in vmemmap_populated()) reused 'start' variable to compute the starting address of the memory section where the given address belongs. Then the same variable is used for iterating over starting address of all memory sections before reaching the 'end' address. Renaming it as 'section_start' makes the logic more clear.
--- arch/powerpc/mm/init_64.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
arch/powerpc/mm/init_64.c +8 -4
@@ -170,11 +170,15 @@ static unsigned long __meminit vmemmap_section_start(unsigned long page)*/ static int __meminit vmemmap_populated (unsigned long start,int page_size) { -unsigned long end = start + page_size; - start = (unsigned long )(pfn_to_page (vmemmap_section_start (start))); +unsigned long end, section_start; -for (; start < end; start += (PAGES_PER_SECTION *sizeof (struct page ))) -if (pfn_valid (page_to_pfn ((struct page *)start))) + end = start + page_size; + section_start = (unsigned long )(pfn_to_page + (vmemmap_section_start (start))); + +for (; section_start < end; section_start + += (PAGES_PER_SECTION *sizeof (struct page ))) +if (pfn_valid (page_to_pfn ((struct page *)section_start)))return 1 ;return 0 ;
Signature · 1 line
2.1.0
RFC 2/4 powerpc/mm: Add comments to the vmemmap layout
Add some explaination to the layout of vmemmap virtual address space and how physical page mapping is only used for valid PFNs present at any point on the system.
--- arch/powerpc/include/asm/book3s/64/pgtable.h | 41 ++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+)
arch/powerpc/include/asm/book3s/64/pgtable.h +41 -0
@@ -26,6 +26,47 @@#define IOREMAP_BASE (PHB_IO_END)#define IOREMAP_END (KERN_VIRT_START + KERN_VIRT_SIZE) +/* +* Starting address of the virtual address space where all page structs +* for the system physical memory are stored under the vmemmap sparse +* memory model. All possible struct pages are logically stored in a +* sequence in this virtual address space irrespective of the fact +* whether any given PFN is valid or even the memory section is valid +* or not. During boot and memory hotplug add operation when new memory +* sections are added, real physical allocation and hash table bolting +* will be performed. This saves precious physical memory when the system +* really does not have valid PFNs in some address ranges. +* +* vmemmap +--------------+ +* + | page struct +----------+ PFN is valid +* | +--------------+ | +* | | page struct | | PFN is invalid +* | +--------------+ | +* | | page struct +------+ | +* | +--------------+ | | +* | | page struct | | | +* | +--------------+ | | +* | | page struct | | | +* | +--------------+ | | +* | | page struct +--+ | | +* | +--------------+ | | | +* | | page struct | | | | +-------------+ +* | +--------------+ | | +-----> | PFN | +* | | page struct | | | +-------------+ +* | +--------------+ | +---------> | PFN | +* | | page struct | | +-------------+ +* | +--------------+ +-------------> | PFN | +* | | page struct | +-------------+ +* | +--------------+ +----> | PFN | +* | | page struct | | +-------------+ +* | +--------------+ | Bolted in hash table +* | | page struct +-----------+ +* v +--------------+ +* +* VMEMMAP_BASE (0xf000000000000000) region has a total range of 64TB but +* then it uses NR_MEM_SECTIONS * PAGES_PER_SECTION * sizeof(page struct) +* amount of virtual memory from it. +*/ #define vmemmap ((struct page *)VMEMMAP_BASE)/* Advertise special mapping type for AGP */
Signature · 1 line
2.1.0
Re: [RFC 2/4] powerpc/mm: Add comments to the vmemmap layout
Quoted 4 lines · Anshuman Khandual
Add some explaination to the layout of vmemmap virtual address space and how physical page mapping is only used for valid PFNs present at any point on the system.
Quoted 59 lines
Signed-off-by Anshuman Khandual <[email protected]>--- arch/powerpc/include/asm/book3s/64/pgtable.h | 41 ++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+)arch/powerpc/include/asm/book3s/64/pgtable.h +41
-0@@ -26,6 +26,47 @@#define IOREMAP_BASE (PHB_IO_END)#define IOREMAP_END (KERN_VIRT_START + KERN_VIRT_SIZE) +/* +* Starting address of the virtual address space where all page structs +* for the system physical memory are stored under the vmemmap sparse +* memory model. All possible struct pages are logically stored in a +* sequence in this virtual address space irrespective of the fact +* whether any given PFN is valid or even the memory section is valid +* or not. During boot and memory hotplug add operation when new memory +* sections are added, real physical allocation and hash table bolting +* will be performed. This saves precious physical memory when the system +* really does not have valid PFNs in some address ranges. +* +* vmemmap +--------------+ +* + | page struct +----------+ PFN is valid +* | +--------------+ | +* | | page struct | | PFN is invalid +* | +--------------+ | +* | | page struct +------+ | +* | +--------------+ | | +* | | page struct | | | +* | +--------------+ | | +* | | page struct | | | +* | +--------------+ | | +* | | page struct +--+ | | +* | +--------------+ | | | +* | | page struct | | | | +-------------+ +* | +--------------+ | | +-----> | PFN | +* | | page struct | | | +-------------+ +* | +--------------+ | +---------> | PFN | +* | | page struct | | +-------------+ +* | +--------------+ +-------------> | PFN | +* | | page struct | +-------------+ +* | +--------------+ +----> | PFN | +* | | page struct | | +-------------+ +* | +--------------+ | Bolted in hash table +* | | page struct +-----------+ +* v +--------------+ +* +* VMEMMAP_BASE (0xf000000000000000) region has a total range of 64TB but +* then it uses NR_MEM_SECTIONS * PAGES_PER_SECTION * sizeof(page struct) +* amount of virtual memory from it. +*/ #define vmemmap ((struct page *)VMEMMAP_BASE)/* Advertise special mapping type for AGP */ Signature · 1 line
2.1.0
Michael Ellerman
reviewerRe: [RFC 2/4] powerpc/mm: Add comments to the vmemmap layout
In reply to Anshuman KhandualQuoted 14 lines · Anshuman Khandual
Add some explaination to the layout of vmemmap virtual address space and how physical page mapping is only used for valid PFNs present at any point on the system.
Signed-off-by Anshuman Khandual <[email protected]>--- arch/powerpc/include/asm/book3s/64/pgtable.h | 41 ++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+)arch/powerpc/include/asm/book3s/64/pgtable.h +0
-0
arch/powerpc/include/asm/book3s/64/pgtable.h line 30
Quoted 5 lines
arch/powerpc/include/asm/book3s/64/pgtable.h +2
-0@@ -26,6 +26,47 @@#define IOREMAP_BASE (PHB_IO_END)#define IOREMAP_END (KERN_VIRT_START + KERN_VIRT_SIZE) +/* +* Starting address of the virtual address space where all page structs
This is so far from the variable it's referring to that it's not clear what it refers to. So you should say "vmemmap is the starting ..."
arch/powerpc/include/asm/book3s/64/pgtable.h line 31
Quoted 1 line
arch/powerpc/include/asm/book3s/64/pgtable.h +1
-0+* for the system physical memory are stored under the vmemmap sparse
^
, when using the SPARSEMEM_VMEMMAP
arch/powerpc/include/asm/book3s/64/pgtable.h
Quoted 4 lines
arch/powerpc/include/asm/book3s/64/pgtable.h +4
-0+* memory model. All possible struct pages are logically stored in a +* sequence in this virtual address space irrespective of the fact +* whether any given PFN is valid or even the memory section is valid +* or not.
I know what you mean but I think that could be worded better. But it's too late for me to reword it :)
The key point is that we allocate space for a page struct for each PFN that could be present in the system, including holes in the address space (hence sparse). That has the nice property of meaning there is a constant relationship between the address of a struct page and it's PFN.
arch/powerpc/include/asm/book3s/64/pgtable.h line 36
Quoted 1 line
arch/powerpc/include/asm/book3s/64/pgtable.h +1
-0+* During boot and memory hotplug add operation when new memory
^ ^ or ,
arch/powerpc/include/asm/book3s/64/pgtable.h line 36
Quoted 1 line
arch/powerpc/include/asm/book3s/64/pgtable.h +1
-0+* sections are added, real physical allocation and hash table bolting
^
of struct pages
Quoted 20 lines
arch/powerpc/include/asm/book3s/64/pgtable.h +18
-0+* will be performed. This saves precious physical memory when the system +* really does not have valid PFNs in some address ranges. +* +* vmemmap +--------------+ +* + | page struct +----------+ PFN is valid +* | +--------------+ | +* | | page struct | | PFN is invalid +* | +--------------+ | +* | | page struct +------+ | +* | +--------------+ | | +* | | page struct | | | +* | +--------------+ | | +* | | page struct | | | +* | +--------------+ | | +* | | page struct +--+ | | +* | +--------------+ | | | +* | | page struct | | | | +-------------+ +* | +--------------+ | | +-----> | PFN |
arch/powerpc/include/asm/book3s/64/pgtable.h line 64
Quoted 10 lines
arch/powerpc/include/asm/book3s/64/pgtable.h +10
-0+* | | page struct | | | +-------------+ +* | +--------------+ | +---------> | PFN | +* | | page struct | | +-------------+ +* | +--------------+ +-------------> | PFN | +* | | page struct | +-------------+ +* | +--------------+ +----> | PFN | +* | | page struct | | +-------------+ +* | +--------------+ | Bolted in hash table +* | | page struct +-----------+ +* v +--------------+
The things on the right are not PFNs, they're struct pages. Each one corresponds to a PFN, but that relationship is derived from the vmemap layout, not the physical layout.
I think it's more like:
f000000000000000 c000000000000000 (and also 0x0) vmemmap +--------------+ +--------------+ + | page struct | +--------------> | page struct | | +--------------+ +--------------+ | | page struct | +--------------> | page struct | | +--------------+ | +--------------+ | | page struct | + +------> | page struct | | +--------------+ | +--------------+ | | page struct | | +--> | page struct | | +--------------+ | | +--------------+ | | page struct | | | | +--------------+ | | | | page struct | | | | +--------------+ | | | | page struct | | | | +--------------+ | | | | page struct | | | | +--------------+ | | | | page struct | +-------+ | | +--------------+ | | | page struct | +-----------+ | +--------------+ | | page struct | No mapping | +--------------+ | | page struct | No mapping v +--------------+
Then there's the relationship between struct pages and PFNs:
page_to_pfn
+--------->
vmemmap +--------------+ +-------------+
+ | page struct | +---------> | PFN |
| +--------------+ +-------------+
| | page struct | +---------> | PFN |
| +--------------+ +-------------+
| | page struct | +---------> | PFN |
| +--------------+ +-------------+
| | page struct | +---------> | PFN |
| +--------------+ +-------------+
| | |
| +--------------+
| | |
| +--------------+
| | |
| +--------------+ +-------------+
| | page struct | +---------> | PFN |
| +--------------+ +-------------+
| | |
| +--------------+
| | |
| +--------------+ +-------------+
| | page struct | +---------> | PFN |
| +--------------+ +-------------+
| | page struct | +---------> | PFN |
v +--------------+ +-------------+cheers
Re: [RFC 2/4] powerpc/mm: Add comments to the vmemmap layout
Quoted 137 lines · Michael Ellerman
Quoted 14 lines · Anshuman Khandual
Add some explaination to the layout of vmemmap virtual address space and how physical page mapping is only used for valid PFNs present at any point on the system.
Signed-off-by Anshuman Khandual <[email protected]>--- arch/powerpc/include/asm/book3s/64/pgtable.h | 41 ++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+)arch/powerpc/include/asm/book3s/64/pgtable.h +0
-0arch/powerpc/include/asm/book3s/64/pgtable.h line 30
Quoted 5 lines
arch/powerpc/include/asm/book3s/64/pgtable.h +2
-0@@ -26,6 +26,47 @@#define IOREMAP_BASE (PHB_IO_END)#define IOREMAP_END (KERN_VIRT_START + KERN_VIRT_SIZE) +/* +* Starting address of the virtual address space where all page structs This is so far from the variable it's referring to that it's not clear what it refers to. So you should say "vmemmap is the starting ..."
arch/powerpc/include/asm/book3s/64/pgtable.h line 31
Quoted 1 line
arch/powerpc/include/asm/book3s/64/pgtable.h +1
-0+* for the system physical memory are stored under the vmemmap sparse ^
, when using theSPARSEMEM_VMEMMAParch/powerpc/include/asm/book3s/64/pgtable.h
Quoted 4 lines
arch/powerpc/include/asm/book3s/64/pgtable.h +4
-0+* memory model. All possible struct pages are logically stored in a +* sequence in this virtual address space irrespective of the fact +* whether any given PFN is valid or even the memory section is valid +* or not. I know what you mean but I think that could be worded better. But it's too late for me to reword it :)
The key point is that we allocate space for a page struct for each PFN that could be present in the system, including holes in the address space (hence sparse). That has the nice property of meaning there is a constant relationship between the address of a struct page and it's PFN.
arch/powerpc/include/asm/book3s/64/pgtable.h line 36
Quoted 1 line
arch/powerpc/include/asm/book3s/64/pgtable.h +1
-0+* During boot and memory hotplug add operation when new memory ^ ^ or ,arch/powerpc/include/asm/book3s/64/pgtable.h line 36
Quoted 1 line
arch/powerpc/include/asm/book3s/64/pgtable.h +1
-0+* sections are added, real physical allocation and hash table bolting ^
of struct pagesQuoted 20 lines
arch/powerpc/include/asm/book3s/64/pgtable.h +18
-0+* will be performed. This saves precious physical memory when the system +* really does not have valid PFNs in some address ranges. +* +* vmemmap +--------------+ +* + | page struct +----------+ PFN is valid +* | +--------------+ | +* | | page struct | | PFN is invalid +* | +--------------+ | +* | | page struct +------+ | +* | +--------------+ | | +* | | page struct | | | +* | +--------------+ | | +* | | page struct | | | +* | +--------------+ | | +* | | page struct +--+ | | +* | +--------------+ | | | +* | | page struct | | | | +-------------+ +* | +--------------+ | | +-----> | PFN | arch/powerpc/include/asm/book3s/64/pgtable.h line 64
Quoted 10 lines
arch/powerpc/include/asm/book3s/64/pgtable.h +10
-0+* | | page struct | | | +-------------+ +* | +--------------+ | +---------> | PFN | +* | | page struct | | +-------------+ +* | +--------------+ +-------------> | PFN | +* | | page struct | +-------------+ +* | +--------------+ +----> | PFN | +* | | page struct | | +-------------+ +* | +--------------+ | Bolted in hash table +* | | page struct +-----------+ +* v +--------------+ The things on the right are not PFNs, they're struct pages. Each one corresponds to a PFN, but that relationship is derived from the vmemap layout, not the physical layout.
I think it's more like:
f000000000000000 c000000000000000 (and also 0x0) vmemmap +--------------+ +--------------+ + | page struct | +--------------> | page struct | | +--------------+ +--------------+ | | page struct | +--------------> | page struct | | +--------------+ | +--------------+ | | page struct | + +------> | page struct | | +--------------+ | +--------------+ | | page struct | | +--> | page struct | | +--------------+ | | +--------------+ | | page struct | | | | +--------------+ | | | | page struct | | | | +--------------+ | | | | page struct | | | | +--------------+ | | | | page struct | | | | +--------------+ | | | | page struct | +-------+ | | +--------------+ | | | page struct | +-----------+ | +--------------+ | | page struct | No mapping | +--------------+ | | page struct | No mapping v +--------------+Then there's the relationship between struct pages and PFNs:
page_to_pfn +---------> vmemmap +--------------+ +-------------+ + | page struct | +---------> | PFN | | +--------------+ +-------------+ | | page struct | +---------> | PFN | | +--------------+ +-------------+ | | page struct | +---------> | PFN | | +--------------+ +-------------+ | | page struct | +---------> | PFN | | +--------------+ +-------------+ | | | | +--------------+ | | | | +--------------+ | | | | +--------------+ +-------------+ | | page struct | +---------> | PFN | | +--------------+ +-------------+
Quoted 8 lines
| | |
| +--------------+
| | |
| +--------------+ +-------------+
| | page struct | +---------> | PFN |
| +--------------+ +-------------+
| | page struct | +---------> | PFN |
v +--------------+ +-------------+Awesome, this conveys the message better. Will change it next time around. Thanks !
RFC 3/4 powerpc/mm: Rename the vmemmap_backing struct and its elements
In reply to Anshuman KhandualThe structure to track single virtual to physical mapping has been renamed from vmemmap_backing to vmemmap_hw_map which sounds more appropriate. This forms a single entry of the global linked list tracking all of the vmemmap physical mapping. The changes are as follows.
vmemmap_backing.list -> vmemmap_hw_map.link vmemmap_backing.phys -> vmemmap_hw_map.paddr vmemmap_backing.virt_addr -> vmemmap_hw_map.vaddr
--- arch/powerpc/include/asm/pgalloc-64.h | 16 +++++++--- arch/powerpc/kernel/machine_kexec.c | 8 ++--- arch/powerpc/mm/init_64.c | 58 +++++++++++++++++------------------ 3 files changed, 44 insertions(+), 38 deletions(-)
arch/powerpc/include/asm/pgalloc-64.h +11 -5
@@ -11,12 +11,18 @@#include <linux/cpumask.h> #include <linux/percpu.h> -struct vmemmap_backing { -struct vmemmap_backing *list; -unsigned long phys; -unsigned long virt_addr; +/* +* This structure tracks a single virtual page mapping from +* the vmemmap ddress space. This element is required to +* track virtual to physical mapping of page structures in +* absense of a page table at boot time. +*/ +struct vmemmap_hw_map { +struct vmemmap_hw_map *link; +unsigned long paddr; +unsigned long vaddr; }; -extern struct vmemmap_backing *vmemmap_list; +extern struct vmemmap_hw_map *vmemmap_list;/* * Functions that deal with pagetables that could be at any level of
arch/powerpc/kernel/machine_kexec.c +4 -4
@@ -80,10 +80,10 @@ void arch_crash_save_vmcoreinfo(void)VMCOREINFO_SYMBOL (vmemmap_list);VMCOREINFO_SYMBOL (mmu_vmemmap_psize);VMCOREINFO_SYMBOL (mmu_psize_defs); -VMCOREINFO_STRUCT_SIZE (vmemmap_backing); -VMCOREINFO_OFFSET (vmemmap_backing, list); -VMCOREINFO_OFFSET (vmemmap_backing, phys); -VMCOREINFO_OFFSET (vmemmap_backing, virt_addr); +VMCOREINFO_STRUCT_SIZE (vmemmap_hw_map); +VMCOREINFO_OFFSET (vmemmap_hw_map, link); +VMCOREINFO_OFFSET (vmemmap_hw_map, paddr); +VMCOREINFO_OFFSET (vmemmap_hw_map, vaddr);VMCOREINFO_STRUCT_SIZE (mmu_psize_def);VMCOREINFO_OFFSET (mmu_psize_def, shift);#endif
arch/powerpc/mm/init_64.c +29 -29
151 lines not on this page · raw message
Signature · 1 line
2.1.0
Re: [RFC 3/4] powerpc/mm: Rename the vmemmap_backing struct and its elements
Quoted 10 lines · Anshuman Khandual
The structure to track single virtual to physical mapping has been renamed from
vmemmap_backingtovmemmap_hw_mapwhich sounds more appropriate. This forms a single entry of the global linked list tracking all of the vmemmap physical mapping. The changes are as follows.vmemmap_backing.list -> vmemmap_hw_map.link vmemmap_backing.phys -> vmemmap_hw_map.paddr vmemmap_backing.virt_addr -> vmemmap_hw_map.vaddr
I am not sure this helps. If we are going to take these renames, can you wait till th book3s p9 preparation patches [1] hit upstream ?
[1] http://mid.gmane.org/[email protected]
-aneesh
Michael Ellerman
reviewerRe: [RFC 3/4] powerpc/mm: Rename the vmemmap_backing struct and its elements
Quoted 9 lines · Aneesh Kumar K.V
Quoted 6 lines · Anshuman Khandual
The structure to track single virtual to physical mapping has been renamed from
vmemmap_backingtovmemmap_hw_mapwhich sounds more appropriate. This forms a single entry of the global linked list tracking all of the vmemmap physical mapping. The changes are as follows.
Quoted 6 lines
Quoted 3 lines
vmemmap_backing.list -> vmemmap_hw_map.link vmemmap_backing.phys -> vmemmap_hw_map.paddr vmemmap_backing.virt_addr -> vmemmap_hw_map.vaddrI am not sure this helps. If we are going to take these renames, can you wait till th book3s p9 preparation patches [1] hit upstream ?
I don't see why the new names are any better, and it's a lot of churn for minimal if any benefit. So I'm not going to take this one.
cheers
RFC 4/4 powerpc/mm: Rename global tracker for virtual to physical mapping
In reply to Anshuman KhandualThis renames the global list which tracks all the virtual to physical mapping and also the global list which tracks all the available unused vmemmap_hw_map node structures. It also attempts to explain the purpose of these global linked lists and points out a possible race condition.
--- arch/powerpc/include/asm/pgalloc-64.h | 2 +- arch/powerpc/kernel/machine_kexec.c | 2 +- arch/powerpc/mm/init_64.c | 82 +++++++++++++++++++++-------------- 3 files changed, 52 insertions(+), 34 deletions(-)
arch/powerpc/include/asm/pgalloc-64.h +1 -1
@@ -22,7 +22,7 @@ struct vmemmap_hw_map {unsigned long paddr;unsigned long vaddr; }; -extern struct vmemmap_hw_map *vmemmap_list; +extern struct vmemmap_hw_map *vmemmap_global;/* * Functions that deal with pagetables that could be at any level of
arch/powerpc/kernel/machine_kexec.c +1 -1
@@ -77,7 +77,7 @@ void arch_crash_save_vmcoreinfo(void)VMCOREINFO_SYMBOL (contig_page_data);#endif #if defined(CONFIG_PPC64 ) && defined(CONFIG_SPARSEMEM_VMEMMAP ) -VMCOREINFO_SYMBOL (vmemmap_list); +VMCOREINFO_SYMBOL (vmemmap_global);VMCOREINFO_SYMBOL (mmu_vmemmap_psize);VMCOREINFO_SYMBOL (mmu_psize_defs);VMCOREINFO_STRUCT_SIZE (vmemmap_hw_map);
arch/powerpc/mm/init_64.c +50 -32
156 lines not on this page · raw message
Signature · 1 line
2.1.0
Michael Ellerman
reviewerRe: [RFC 4/4] powerpc/mm: Rename global tracker for virtual to physical mapping
Quoted 3 lines · Anshuman Khandual
This renames the global list which tracks all the virtual to physical mapping and also the global list which tracks all the available unused
vmemmap_hw_mapnode structures.
But why? Why are the new names *so* much better that we would want to go through all this churn?
Quoted 2 lines
It also attempts to explain the purpose
of these global linked lists and points out a possible race condition.
I'm happy to take the comments.
cheers
Re: [RFC 4/4] powerpc/mm: Rename global tracker for virtual to physical mapping
Quoted 8 lines · Michael Ellerman
Quoted 3 lines · Anshuman Khandual
This renames the global list which tracks all the virtual to physical mapping and also the global list which tracks all the available unused
vmemmap_hw_mapnode structures.But why? Why are the new names *so* much better that we would want to go through all this churn?
Hmm, okay. Its kind of subjective but then its upto you.
Quoted 5 lines
Quoted 3 lines
It also attempts to explain the purpose
of these global linked lists and points out a possible race condition.I'm happy to take the comments.
Sure, will send across next time around separately.
Michael Ellerman
reviewerRe: [RFC 4/4] powerpc/mm: Rename global tracker for virtual to physical mapping
Quoted 11 lines · Anshuman Khandual
Quoted 8 lines · Michael Ellerman
Quoted 3 lines · Anshuman Khandual
This renames the global list which tracks all the virtual to physical mapping and also the global list which tracks all the available unused
vmemmap_hw_mapnode structures.But why? Why are the new names *so* much better that we would want to go through all this churn?
Hmm, okay. Its kind of subjective but then its upto you.
Yeah it is of course. I'm not saying your names aren't better, but they're not obviously better to me, and so it's a lot of code churn for not much benefit IMHO.
But you can try and convince me if you really feel strongly about it.
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
It also attempts to explain the purpose
of these global linked lists and points out a possible race condition.I'm happy to take the comments.
Sure, will send across next time around separately.
Thanks.
cheers
Re: [RFC 4/4] powerpc/mm: Rename global tracker for virtual to physical mapping
Quoted 11 lines · Michael Ellerman
Quoted 10 lines · Anshuman Khandual
Quoted 10 lines · Michael Ellerman
Quoted 8 lines
Quoted 8 lines · Anshuman Khandual
Quoted 4 lines
Quoted 4 lines
This renames the global list which tracks all the virtual to physical mapping and also the global list which tracks all the available unused
vmemmap_hw_mapnode structures.But why? Why are the new names *so* much better that we would want to go through all this churn?
Quoted 6 lines
Quoted 1 line
Quoted 1 line
Hmm, okay. Its kind of subjective but then its upto you.
Yeah it is of course. I'm not saying your names aren't better, but they're not obviously better to me, and so it's a lot of code churn for not much benefit IMHO.
But you can try and convince me if you really feel strongly about it.
Agreed, its not worth the churn. Thanks !
Michael Ellerman
reviewerQuoted 8 lines · Anshuman Khandual
The commit (
16a05bff1: powerpc: start loop at section start of start invmemmap_populated()) reused 'start' variable to compute the starting address of the memory section where the given address belongs. Then the same variable is used for iterating over starting address of all memory sections before reaching the 'end' address. Renaming it as 'section_start' makes the logic more clear.Fixes 16a05bff1 ("powerpc: start loop at section start of start in vmemmap_populated()")
It's not a fix, just a cleanup. Fixes lines should be reserved for actual bug fixes.
Quoted 19 lines
Signed-off-by Anshuman Khandual <[email protected]>--- arch/powerpc/mm/init_64.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)arch/powerpc/mm/init_64.c +1
-4@@ -170,11 +170,15 @@ static unsigned long __meminit vmemmap_section_start(unsigned long page)*/ static int __meminit vmemmap_populated (unsigned long start,int page_size) { -unsigned long end = start + page_size; - start = (unsigned long )(pfn_to_page (vmemmap_section_start (start))); +unsigned long end, section_start; -for (; start < end; start += (PAGES_PER_SECTION *sizeof (struct page ))) -if (pfn_valid (page_to_pfn ((struct page *)start)))
arch/powerpc/mm/init_64.c static unsigned long __meminit vmemmap_section_start(unsigned long page) · line 184
Quoted 10 lines
arch/powerpc/mm/init_64.c +7
-0+ end = start + page_size; + section_start = (unsigned long )(pfn_to_page + (vmemmap_section_start (start))); + +for (; section_start < end; section_start + += (PAGES_PER_SECTION *sizeof (struct page ))) +if (pfn_valid (page_to_pfn ((struct page *)section_start)))return 1 ;return 0 ;
That's not a big improvement.
But I think this code could be improved. There's a lot of casts, it seems to be confused about whether it's iterating over addresses or struct pages.
cheers
Quoted 9 lines · Michael Ellerman
Quoted 7 lines · Anshuman Khandual
The commit (
16a05bff1: powerpc: start loop at section start of start invmemmap_populated()) reused 'start' variable to compute the starting address of the memory section where the given address belongs. Then the same variable is used for iterating over starting address of all memory sections before reaching the 'end' address. Renaming it as 'section_start' makes the logic more clear.
Quoted 4 lines
Quoted 1 line
Fixes 16a05bff1 ("powerpc: start loop at section start of start in vmemmap_populated()")It's not a fix, just a cleanup. Fixes lines should be reserved for actual bug fixes.
Sure, got it.
Quoted 29 lines
Quoted 29 lines
Signed-off-by Anshuman Khandual <[email protected]>--- arch/powerpc/mm/init_64.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)arch/powerpc/mm/init_64.c +8
-4@@ -170,11 +170,15 @@ static unsigned long __meminit vmemmap_section_start(unsigned long page)*/ static int __meminit vmemmap_populated (unsigned long start,int page_size) { -unsigned long end = start + page_size; - start = (unsigned long )(pfn_to_page (vmemmap_section_start (start))); +unsigned long end, section_start; -for (; start < end; start += (PAGES_PER_SECTION *sizeof (struct page ))) -if (pfn_valid (page_to_pfn ((struct page *)start))) + end = start + page_size; + section_start = (unsigned long )(pfn_to_page + (vmemmap_section_start (start))); + +for (; section_start < end; section_start + += (PAGES_PER_SECTION *sizeof (struct page ))) +if (pfn_valid (page_to_pfn ((struct page *)section_start)))return 1 ;
Quoted 6 lines
arch/powerpc/mm/init_64.c static unsigned long __meminit vmemmap_section_start(unsigned long page) · line 184
Quoted 1 line
arch/powerpc/mm/init_64.c +0
-0return 0 ;That's not a big improvement.
But I think this code could be improved. There's a lot of casts, it seems to be confused about whether it's iterating over addresses or struct pages.
Right, this patch just tries to clear on such confusion. Thats all.