* [PATCH] modifing vmemmap initialization [0/1] : move vmemmap creation
@ 2004-12-21 7:11 Hiroyuki KAMEZAWA
2004-12-21 7:20 ` [PATCH] modifing vmemmap initialization [1/1] : modifies init sequence Hiroyuki KAMEZAWA
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Hiroyuki KAMEZAWA @ 2004-12-21 7:11 UTC (permalink / raw)
To: linux-ia64
[-- Attachment #1: Type: text/plain, Size: 492 bytes --]
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 <kamezawa.hiroyu@jp.fujitsu.com>
[-- Attachment #2: vmemmap_init_cleanup.patch --]
[-- Type: text/x-patch, Size: 4154 bytes --]
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(-)
diff -puN arch/ia64/mm/contig.c~vmemmap_init_cleanup arch/ia64/mm/contig.c
--- linux-2.6.10-rc3-mm1/arch/ia64/mm/contig.c~vmemmap_init_cleanup 2004-12-21 14:15:35.383402648 +0900
+++ linux-2.6.10-rc3-mm1-kamezawa/arch/ia64/mm/contig.c 2004-12-21 14:53:13.801070976 +0900
@@ -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;
diff -puN arch/ia64/mm/discontig.c~vmemmap_init_cleanup arch/ia64/mm/discontig.c
--- linux-2.6.10-rc3-mm1/arch/ia64/mm/discontig.c~vmemmap_init_cleanup 2004-12-21 14:15:35.385402344 +0900
+++ linux-2.6.10-rc3-mm1-kamezawa/arch/ia64/mm/discontig.c 2004-12-21 14:53:13.801070976 +0900
@@ -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;
diff -puN arch/ia64/mm/init.c~vmemmap_init_cleanup arch/ia64/mm/init.c
--- linux-2.6.10-rc3-mm1/arch/ia64/mm/init.c~vmemmap_init_cleanup 2004-12-21 14:15:35.388401888 +0900
+++ linux-2.6.10-rc3-mm1-kamezawa/arch/ia64/mm/init.c 2004-12-21 14:54:09.314631632 +0900
@@ -407,6 +407,30 @@ create_mem_map_page_table (u64 start, u6
return 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;
diff -puN include/asm-ia64/meminit.h~vmemmap_init_cleanup include/asm-ia64/meminit.h
--- linux-2.6.10-rc3-mm1/include/asm-ia64/meminit.h~vmemmap_init_cleanup 2004-12-21 14:39:24.510142360 +0900
+++ linux-2.6.10-rc3-mm1-kamezawa/include/asm-ia64/meminit.h 2004-12-21 14:53:44.072469024 +0900
@@ -55,6 +55,8 @@ extern int filter_rsvd_memory (unsigned
extern 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 */
_
^ permalink raw reply [flat|nested] 5+ messages in thread* [PATCH] modifing vmemmap initialization [1/1] : modifies init sequence
2004-12-21 7:11 [PATCH] modifing vmemmap initialization [0/1] : move vmemmap creation Hiroyuki KAMEZAWA
@ 2004-12-21 7:20 ` Hiroyuki KAMEZAWA
2004-12-21 18:33 ` Christoph Hellwig
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Hiroyuki KAMEZAWA @ 2004-12-21 7:20 UTC (permalink / raw)
To: linux-ia64
[-- Attachment #1: Type: text/plain, Size: 387 bytes --]
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 <kamezawa.horoyu@jp.fujitsu.com>
[-- Attachment #2: vmemmap_adjust_callpath.patch --]
[-- Type: text/x-patch, Size: 4411 bytes --]
Curret ia64's vmem_map initialization path is different from other archs.
This patch modifies it.
Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
---
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(-)
diff -puN arch/ia64/mm/init.c~vmemmap_adjust_callpath arch/ia64/mm/init.c
--- linux-2.6.10-rc3-mm1/arch/ia64/mm/init.c~vmemmap_adjust_callpath 2004-12-21 14:55:46.204902072 +0900
+++ linux-2.6.10-rc3-mm1-kamezawa/arch/ia64/mm/init.c 2004-12-21 14:55:46.216900248 +0900
@@ -407,7 +407,7 @@ create_mem_map_page_table (u64 start, u6
return 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_data
unsigned 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 {
diff -puN arch/ia64/mm/contig.c~vmemmap_adjust_callpath arch/ia64/mm/contig.c
--- linux-2.6.10-rc3-mm1/arch/ia64/mm/contig.c~vmemmap_adjust_callpath 2004-12-21 14:55:46.206901768 +0900
+++ linux-2.6.10-rc3-mm1-kamezawa/arch/ia64/mm/contig.c 2004-12-21 14:55:46.217900096 +0900
@@ -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 */
diff -puN arch/ia64/mm/discontig.c~vmemmap_adjust_callpath arch/ia64/mm/discontig.c
--- linux-2.6.10-rc3-mm1/arch/ia64/mm/discontig.c~vmemmap_adjust_callpath 2004-12-21 14:55:46.208901464 +0900
+++ linux-2.6.10-rc3-mm1-kamezawa/arch/ia64/mm/discontig.c 2004-12-21 14:55:46.217900096 +0900
@@ -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);
}
diff -puN mm/page_alloc.c~vmemmap_adjust_callpath mm/page_alloc.c
--- linux-2.6.10-rc3-mm1/mm/page_alloc.c~vmemmap_adjust_callpath 2004-12-21 14:55:46.211901008 +0900
+++ linux-2.6.10-rc3-mm1-kamezawa/mm/page_alloc.c 2004-12-21 14:55:46.219899792 +0900
@@ -1738,7 +1738,10 @@ static void __init free_area_init_core(s
void __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);
diff -puN include/asm-ia64/meminit.h~vmemmap_adjust_callpath include/asm-ia64/meminit.h
--- linux-2.6.10-rc3-mm1/include/asm-ia64/meminit.h~vmemmap_adjust_callpath 2004-12-21 14:55:46.214900552 +0900
+++ linux-2.6.10-rc3-mm1-kamezawa/include/asm-ia64/meminit.h 2004-12-21 14:55:46.220899640 +0900
@@ -56,7 +56,7 @@ extern int filter_rsvd_memory (unsigned
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);
+ extern struct page *virtual_mem_map_alloc(struct pglist_data *pgdat);
#endif
#endif /* meminit_h */
_
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH] modifing vmemmap initialization [1/1] : modifies init sequence
2004-12-21 7:11 [PATCH] modifing vmemmap initialization [0/1] : move vmemmap creation Hiroyuki KAMEZAWA
2004-12-21 7:20 ` [PATCH] modifing vmemmap initialization [1/1] : modifies init sequence Hiroyuki KAMEZAWA
@ 2004-12-21 18:33 ` Christoph Hellwig
2004-12-21 18:39 ` Matthew Wilcox
2004-12-22 1:16 ` [PATCH] modifing vmemmap initialization [1/1] : modifies init Hiroyuki KAMEZAWA
3 siblings, 0 replies; 5+ messages in thread
From: Christoph Hellwig @ 2004-12-21 18:33 UTC (permalink / raw)
To: linux-ia64
On Tue, Dec 21, 2004 at 04:20:29PM +0900, Hiroyuki KAMEZAWA wrote:
>
> 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.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] modifing vmemmap initialization [1/1] : modifies init sequence
2004-12-21 7:11 [PATCH] modifing vmemmap initialization [0/1] : move vmemmap creation Hiroyuki KAMEZAWA
2004-12-21 7:20 ` [PATCH] modifing vmemmap initialization [1/1] : modifies init sequence Hiroyuki KAMEZAWA
2004-12-21 18:33 ` Christoph Hellwig
@ 2004-12-21 18:39 ` Matthew Wilcox
2004-12-22 1:16 ` [PATCH] modifing vmemmap initialization [1/1] : modifies init Hiroyuki KAMEZAWA
3 siblings, 0 replies; 5+ messages in thread
From: Matthew Wilcox @ 2004-12-21 18:39 UTC (permalink / raw)
To: linux-ia64
On Tue, Dec 21, 2004 at 06:33:55PM +0000, Christoph Hellwig wrote:
> On Tue, Dec 21, 2004 at 04:20:29PM +0900, Hiroyuki KAMEZAWA wrote:
> >
> > 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?)
--
"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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] modifing vmemmap initialization [1/1] : modifies init
2004-12-21 7:11 [PATCH] modifing vmemmap initialization [0/1] : move vmemmap creation Hiroyuki KAMEZAWA
` (2 preceding siblings ...)
2004-12-21 18:39 ` Matthew Wilcox
@ 2004-12-22 1:16 ` Hiroyuki KAMEZAWA
3 siblings, 0 replies; 5+ messages in thread
From: Hiroyuki KAMEZAWA @ 2004-12-22 1:16 UTC (permalink / raw)
To: linux-ia64
Matthew Wilcox wrote:
>>>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.
> (I also hope it'll go away. Where's CONFIG_NONLINEAR got 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 <kamezawa.hiroyu@jp.fujitsu.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2004-12-22 1:16 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-12-21 7:11 [PATCH] modifing vmemmap initialization [0/1] : move vmemmap creation Hiroyuki KAMEZAWA
2004-12-21 7:20 ` [PATCH] modifing vmemmap initialization [1/1] : modifies init sequence Hiroyuki KAMEZAWA
2004-12-21 18:33 ` Christoph Hellwig
2004-12-21 18:39 ` Matthew Wilcox
2004-12-22 1:16 ` [PATCH] modifing vmemmap initialization [1/1] : modifies init Hiroyuki KAMEZAWA
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox