modifing vmemmap initialization [0/1] : move vmemmap creation
Subsystems (2)
PATCH 1/1 modifing vmemmap initialization [0/1] : move vmemmap creation
Hi
In current tree, mem_map is allocated in mm/page_alloc.c::node_alloc_mem_map() when !defined(CONFIG_VIRTUAL_MEM_MAP).
So, ia64's vmem_map initialization, which is done before calling free_area_init(), seems to be different from other archs.
Following 2 patches modifies vmem_map init call sequence to fit to current tree.
all patches are against rc3-mm1.
This patch moves duplicated vmem_map creation call in contig.c/discontig.c to init.c
-- Kame <[email protected]>
This patch moves duplicated vmem_map allocation code from arch/ia64/mm/contig.c and arch/ia64/mm/discontig.c to arch/ia64/mm/init.c.
---
linux-2.6.10-rc3-mm1-kamezawa/arch/ia64/mm/contig.c | 27 ++------------- linux-2.6.10-rc3-mm1-kamezawa/arch/ia64/mm/discontig.c | 7 --- linux-2.6.10-rc3-mm1-kamezawa/arch/ia64/mm/init.c | 24 +++++++++++++ linux-2.6.10-rc3-mm1-kamezawa/include/asm-ia64/meminit.h | 2 + 4 files changed, 31 insertions(+), 29 deletions(-)
arch/ia64/mm/contig.c renamed from arch/ia64/mm/contig.c~vmemmap_init_cleanup +4 -23
@@ -262,29 +262,10 @@ paging_init (void) (num_physpages - num_dma_physpages)); } } - - max_gap =0 ; -efi_memmap_walk (find_largest_hole, (u64 *)&max_gap); -if (max_gap <LARGE_GAP ) { - vmem_map = (struct page *)0 ; -free_area_init_node (0 , &contig_page_data, zones_size,0 , - zholes_size); - }else { -unsigned long map_size; - -/* allocate virtual_mem_map */ - - map_size =PAGE_ALIGN (max_low_pfn *sizeof (struct page )); - vmalloc_end -= map_size; - vmem_map = (struct page *) vmalloc_end; -efi_memmap_walk (create_mem_map_page_table,NULL ); - - mem_map = contig_page_data.node_mem_map = vmem_map; -free_area_init_node (0 , &contig_page_data, zones_size, -0 , zholes_size); - -printk ("Virtual mem_map starts at 0x%p\n" , mem_map); - } +virtual_mem_map_alloc (&contig_page_data); + contig_page_data.node_mem_map = mem_map; +free_area_init_node (0 , &contig_page_data, zones_size, +0 , zholes_size);#else /* !CONFIG_VIRTUAL_MEM_MAP */ if (max_low_pfn < max_dma) zones_size[ZONE_DMA ] = max_low_pfn;
arch/ia64/mm/discontig.c renamed from arch/ia64/mm/discontig.c~vmemmap_init_cleanup +1 -6
@@ -677,12 +677,7 @@ void __init paging_init(void) }if (node ==0 ) { - vmalloc_end -= -PAGE_ALIGN (max_low_pfn *sizeof (struct page )); - vmem_map = (struct page *) vmalloc_end; - -efi_memmap_walk (create_mem_map_page_table,NULL ); -printk ("Virtual mem_map starts at 0x%p\n" , vmem_map); +virtual_mem_map_alloc (NODE_DATA (0 )); } pfn_offset = mem_data[node].min_pfn;
arch/ia64/mm/init.c renamed from arch/ia64/mm/init.c~vmemmap_init_cleanup +24 -0
@@ -407,6 +407,30 @@ create_mem_map_page_table (u64 start, u6return 0 ; } +void +virtual_mem_map_alloc (struct pglist_data *pgdat) +{ +unsigned long map_size; +#ifndef CONFIG_DISCONTIGMEM +unsigned long max_gap =0 ; +efi_memmap_walk (find_largest_hole, (u64 *)&max_gap); +if (max_gap <LARGE_GAP ) { +return ; + } +#endif +if (pgdat ==NODE_DATA (0 )) { + map_size =PAGE_ALIGN (max_low_pfn *sizeof (struct page )); + vmalloc_end -= map_size; + vmem_map = (struct page *)vmalloc_end; +efi_memmap_walk (create_mem_map_page_table ,NULL ); +printk ("Virtual mem_map starts at 0x%p\n" , vmem_map); +#ifndef CONFIG_DISCONTIGMEM + mem_map = vmem_map; +#endif + } +return ; +} +struct memmap_init_callback_data {struct page *start;struct page *end;
include/asm-ia64/meminit.h renamed from include/asm-ia64/meminit.h~vmemmap_init_cleanup +2 -0
@@ -55,6 +55,8 @@ extern int filter_rsvd_memory (unsignedextern struct page *vmem_map;extern int find_largest_hole (u64 start,u64 end,void *arg);extern int create_mem_map_page_table (u64 start,u64 end,void *arg); +struct pglist_data ; +extern void virtual_mem_map_alloc (struct pglist_data *pgdat);#endif #endif /* meminit_h */
_
PATCH 1/1 modifing vmemmap initialization [1/1] : modifies init sequence
This patch adjust calling sequence of virtual_mem_map_alloc(), which is added by previous patch.
There are 3 combinations of config.. CONFIG_DISCONTIGMEM != y && CONFIG_VIRTUAL_MEM_MAP != y CONFIG_DISCONTIGMEM != y && CONFIG_VIRTUAL_MEM_MAP = y CONFIG_DISCONTIGMEM = y && CONFIG_VIRTUAL_MEM_MAP = y I don't want to use many #ifdefs but..
-- Kame <[email protected]>
Curret ia64's vmem_map initialization path is different from other archs. This patch modifies it.
---
linux-2.6.10-rc3-mm1-kamezawa/arch/ia64/mm/contig.c | 2 -- linux-2.6.10-rc3-mm1-kamezawa/arch/ia64/mm/discontig.c | 6 ------ linux-2.6.10-rc3-mm1-kamezawa/arch/ia64/mm/init.c | 7 ++++--- linux-2.6.10-rc3-mm1-kamezawa/include/asm-ia64/meminit.h | 2 +- linux-2.6.10-rc3-mm1-kamezawa/mm/page_alloc.c | 7 +++++-- 5 files changed, 10 insertions(+), 14 deletions(-)
arch/ia64/mm/init.c renamed from arch/ia64/mm/init.c~vmemmap_adjust_callpath +4 -3
@@ -407,7 +407,7 @@ create_mem_map_page_table (u64 start, u6return 0 ; } -void +struct page *virtual_mem_map_alloc (struct pglist_data *pgdat) {unsigned long map_size;
@@ -415,7 +415,7 @@ virtual_mem_map_alloc(struct pglist_dataunsigned long max_gap =0 ;efi_memmap_walk (find_largest_hole, (u64 *)&max_gap);if (max_gap <LARGE_GAP ) { -return ; +return NULL ; }#endif if (pgdat ==NODE_DATA (0 )) {
@@ -428,7 +428,8 @@ virtual_mem_map_alloc(struct pglist_data mem_map = vmem_map;#endif } -return ; + pgdat->node_mem_map = vmem_map + pgdat->node_start_pfn; +return pgdat->node_mem_map; }struct memmap_init_callback_data {
arch/ia64/mm/contig.c renamed from arch/ia64/mm/contig.c~vmemmap_adjust_callpath +0 -2
@@ -262,8 +262,6 @@ paging_init (void) (num_physpages - num_dma_physpages)); } } -virtual_mem_map_alloc (&contig_page_data); - contig_page_data.node_mem_map = mem_map;free_area_init_node (0 , &contig_page_data, zones_size,0 , zholes_size);#else /* !CONFIG_VIRTUAL_MEM_MAP */
arch/ia64/mm/discontig.c renamed from arch/ia64/mm/discontig.c~vmemmap_adjust_callpath +0 -6
@@ -676,13 +676,7 @@ void __init paging_init(void) mem_data[node].num_dma_physpages); } -if (node ==0 ) { -virtual_mem_map_alloc (NODE_DATA (0 )); - } - pfn_offset = mem_data[node].min_pfn; - -NODE_DATA (node)->node_mem_map = vmem_map + pfn_offset;free_area_init_node (node,NODE_DATA (node), zones_size, pfn_offset, zholes_size); }
mm/page_alloc.c renamed from mm/page_alloc.c~vmemmap_adjust_callpath +5 -2
@@ -1738,7 +1738,10 @@ static void __init free_area_init_core(svoid __init node_alloc_mem_map (struct pglist_data *pgdat) {unsigned long size; - +#ifdef CONFIG_VIRTUAL_MEM_MAP +if (virtual_mem_map_alloc (pgdat)) +return ; +#endif size = (pgdat->node_spanned_pages +1 ) *sizeof (struct page ); pgdat->node_mem_map =alloc_bootmem_node (pgdat, size);#ifndef CONFIG_DISCONTIGMEM
@@ -1754,7 +1757,7 @@ void __init free_area_init_node(int nid, pgdat->node_start_pfn = node_start_pfn;calculate_zone_totalpages (pgdat, zones_size, zholes_size); -if (!pfn_to_page (node_start_pfn)) +if (!pgdat->node_mem_map && pgdat->node_spanned_pages)node_alloc_mem_map (pgdat);free_area_init_core (pgdat, zones_size, zholes_size);
include/asm-ia64/meminit.h renamed from include/asm-ia64/meminit.h~vmemmap_adjust_callpath +1 -1
@@ -56,7 +56,7 @@ extern int filter_rsvd_memory (unsignedextern int find_largest_hole (u64 start,u64 end,void *arg);extern int create_mem_map_page_table (u64 start,u64 end,void *arg);struct pglist_data ; -extern void virtual_mem_map_alloc (struct pglist_data *pgdat); +extern struct page *virtual_mem_map_alloc (struct pglist_data *pgdat);#endif #endif /* meminit_h */
_
Re: [PATCH] modifing vmemmap initialization [1/1] : modifies init sequence
In reply to Hiroyuki KAMEZAWAQuoted 3 lines · Hiroyuki KAMEZAWA
This patch adjust calling sequence of
virtual_mem_map_alloc(), which is added by previous patch.
This doesn't look like an improvement at all, the whole virtual memmap should not need core ifdefs. In fact I still hope it'll go away.
Re: [PATCH] modifing vmemmap initialization [1/1] : modifies init sequence
In reply to Hiroyuki KAMEZAWAQuoted 7 lines · Christoph Hellwig
Quoted 3 lines · Hiroyuki KAMEZAWA
This patch adjust calling sequence of
virtual_mem_map_alloc(), which is added by previous patch.This doesn't look like an improvement at all, the whole virtual memmap should not need core ifdefs. In fact I still hope it'll go away.
It doesn't need core ifdefs at all -- simply define a dummy virtual_mem_map_alloc() and you can remove the ifdefs.
(I also hope it'll go away. Where's CONFIG_NONLINEAR got to?)
Signature · 6 lines
"Next the statesmen will invent cheap lies, putting the blame upon the nation that is attacked, and every man will be glad of those conscience-soothing falsities, and will diligently study them, and refuse to examine any refutations of them; and thus he will by and by convince himself that the war is just, and will thank God for the better sleep he enjoys after this process of grotesque self-deception." -- Mark Twain
Re: [PATCH] modifing vmemmap initialization [1/1] : modifies init
In reply to Hiroyuki KAMEZAWAQuoted 10 lines · Matthew Wilcox
Quoted 5 lines
Quoted 2 lines
This patch adjust calling sequence of
virtual_mem_map_alloc(), which is added by previous patch.This doesn't look like an improvement at all, the whole virtual memmap should not need core ifdefs. In fact I still hope it'll go away.
It doesn't need core ifdefs at all -- simply define a dummy
virtual_mem_map_alloc()and you can remove the ifdefs.
I'm thinking about pass "memmap allocation function" as a free_area_init_node()'s argument. Such args can be used in i386(or some) NUMA case, which doesn't use alloc_bootmem(). Anyway, my patch is not good.
Quoted 2 lines
(I also hope it'll go away. Where's
CONFIG_NONLINEARgot to?)
Robert Picco's one was intended to avoid using CONFIG_VIRTUAL_MEM_MAP. I wrote another one, which uses CONFIG_VIRTUAL_MEM_MAP, and it was too complicated :(
-- Kame <[email protected]>