* [RFC][PATCH] no per-arch mem_map init
@ 2005-02-08 19:37 Dave Hansen
2005-02-09 0:39 ` [Lhms-devel] " Yasunori Goto
2005-02-09 1:04 ` Bob Picco
0 siblings, 2 replies; 6+ messages in thread
From: Dave Hansen @ 2005-02-08 19:37 UTC (permalink / raw)
To: lhms; +Cc: Jesse Barnes, Bob Picco, linux-mm
[-- Attachment #1: Type: text/plain, Size: 332 bytes --]
This patch has been one of the base patches in the -mhp tree for a bit
now, and seems to be working pretty well, at least on x86. I would like
to submit it upstream, but I want to get a bit more testing first. Is
there a chance you ia64 guys could give it a quick test boot to make
sure that it doesn't screw you over?
-- Dave
[-- Attachment #2: A6-no_arch_mem_map_init.patch --]
[-- Type: text/x-patch, Size: 10474 bytes --]
So, this patch started out with me trying to keep from passing
contiguous, node-specific mem_map into free_area_init_node() and
cousins. Instead, I relied on some calls to pfn_to_page().
This works fine and dandy when all you need is the pgdat->node_mem_map
to do pfn_to_page(). However, the non-NUMA/DISCONTIG architectures use
the real, global mem_map[] instead of a node_mem_map in the
pfn_to_page() calculation. So, I ended up effectively trying to
initialize mem_map from itself, when it was NULL. That was bad, and
caused some very pretty colors on someone's screen when he tested it.
So, I had to make sure to initialize the global mem_map[] before calling
into free_area_init_node(). Then, I realized how many architectures do
this on their own, and have comments like this:
/* XXX: MRB-remove - this doesn't seem sane, should this be done somewhere else ?*/
mem_map = NODE_DATA(0)->node_mem_map;
The following patch does what my first one did (don't pass mem_map into
the init functions), incorporates Jesse Barnes' ia64 fixes on top of
that, and gets rid of all but one of the global mem_map initializations
(parisc is weird). It also magically removes more code than it adds.
It could be smaller, but I shamelessly added some comments.
Boot-tested on ppc64, i386 (NUMAQ, plain SMP, laptop), UML (i386).
Signed-off-by: Dave Hansen <haveblue@us.ibm.com>
---
memhotplug-dave/arch/arm/mm/init.c | 4 ----
memhotplug-dave/arch/arm26/mm/init.c | 2 --
memhotplug-dave/arch/cris/arch-v10/mm/init.c | 1 -
memhotplug-dave/arch/ia64/mm/contig.c | 2 +-
memhotplug-dave/arch/m32r/mm/init.c | 2 --
memhotplug-dave/arch/ppc64/mm/init.c | 1 -
memhotplug-dave/arch/sh/mm/init.c | 2 --
memhotplug-dave/arch/sh64/mm/init.c | 3 ---
memhotplug-dave/arch/sparc/mm/srmmu.c | 1 -
memhotplug-dave/arch/sparc/mm/sun4c.c | 1 -
memhotplug-dave/arch/sparc64/mm/init.c | 1 -
memhotplug-dave/arch/um/kernel/physmem.c | 1 -
memhotplug-dave/arch/v850/kernel/setup.c | 1 -
memhotplug-dave/mm/page_alloc.c | 18 ++++++++++++++----
14 files changed, 15 insertions(+), 25 deletions(-)
diff -puN arch/arm/mm/init.c~A6-no_arch_mem_map_init arch/arm/mm/init.c
--- memhotplug/arch/arm/mm/init.c~A6-no_arch_mem_map_init 2005-02-04 15:21:57.000000000 -0800
+++ memhotplug-dave/arch/arm/mm/init.c 2005-02-04 15:21:57.000000000 -0800
@@ -501,10 +501,6 @@ void __init paging_init(struct meminfo *
bdata->node_boot_start >> PAGE_SHIFT, zhole_size);
}
-#ifndef CONFIG_DISCONTIGMEM
- mem_map = contig_page_data.node_mem_map;
-#endif
-
/*
* finish off the bad pages once
* the mem_map is initialised
diff -puN arch/arm26/mm/init.c~A6-no_arch_mem_map_init arch/arm26/mm/init.c
--- memhotplug/arch/arm26/mm/init.c~A6-no_arch_mem_map_init 2005-02-04 15:21:57.000000000 -0800
+++ memhotplug-dave/arch/arm26/mm/init.c 2005-02-04 15:21:57.000000000 -0800
@@ -309,8 +309,6 @@ void __init paging_init(struct meminfo *
free_area_init_node(0, pgdat, zone_size,
bdata->node_boot_start >> PAGE_SHIFT, zhole_size);
- mem_map = NODE_DATA(0)->node_mem_map;
-
/*
* finish off the bad pages once
* the mem_map is initialised
diff -puN arch/cris/arch-v10/mm/init.c~A6-no_arch_mem_map_init arch/cris/arch-v10/mm/init.c
--- memhotplug/arch/cris/arch-v10/mm/init.c~A6-no_arch_mem_map_init 2005-02-04 15:21:57.000000000 -0800
+++ memhotplug-dave/arch/cris/arch-v10/mm/init.c 2005-02-04 15:21:57.000000000 -0800
@@ -184,7 +184,6 @@ paging_init(void)
*/
free_area_init_node(0, &contig_page_data, zones_size, PAGE_OFFSET >> PAGE_SHIFT, 0);
- mem_map = contig_page_data.node_mem_map;
}
/* Initialize remaps of some I/O-ports. It is important that this
diff -puN arch/i386/mm/discontig.c~A6-no_arch_mem_map_init arch/i386/mm/discontig.c
diff -puN arch/ia64/mm/contig.c~A6-no_arch_mem_map_init arch/ia64/mm/contig.c
--- memhotplug/arch/ia64/mm/contig.c~A6-no_arch_mem_map_init 2005-02-04 15:21:57.000000000 -0800
+++ memhotplug-dave/arch/ia64/mm/contig.c 2005-02-04 15:21:57.000000000 -0800
@@ -280,7 +280,7 @@ paging_init (void)
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;
+ NODE_DATA(0)->node_mem_map = vmem_map;
free_area_init_node(0, &contig_page_data, zones_size,
0, zholes_size);
diff -puN arch/ppc64/mm/init.c~A6-no_arch_mem_map_init arch/ppc64/mm/init.c
--- memhotplug/arch/ppc64/mm/init.c~A6-no_arch_mem_map_init 2005-02-04 15:21:57.000000000 -0800
+++ memhotplug-dave/arch/ppc64/mm/init.c 2005-02-08 09:59:02.000000000 -0800
@@ -659,7 +659,6 @@ void __init paging_init(void)
free_area_init_node(0, &contig_page_data, zones_size,
__pa(PAGE_OFFSET) >> PAGE_SHIFT, zholes_size);
- mem_map = contig_page_data.node_mem_map;
}
#endif /* CONFIG_DISCONTIGMEM */
diff -puN arch/sh/mm/init.c~A6-no_arch_mem_map_init arch/sh/mm/init.c
--- memhotplug/arch/sh/mm/init.c~A6-no_arch_mem_map_init 2005-02-04 15:21:57.000000000 -0800
+++ memhotplug-dave/arch/sh/mm/init.c 2005-02-04 15:21:57.000000000 -0800
@@ -216,8 +216,6 @@ void __init paging_init(void)
#endif
NODE_DATA(0)->node_mem_map = NULL;
free_area_init_node(0, NODE_DATA(0), zones_size, __MEMORY_START >> PAGE_SHIFT, 0);
- /* XXX: MRB-remove - this doesn't seem sane, should this be done somewhere else ?*/
- mem_map = NODE_DATA(0)->node_mem_map;
#ifdef CONFIG_DISCONTIGMEM
/*
diff -puN arch/sh64/mm/init.c~A6-no_arch_mem_map_init arch/sh64/mm/init.c
--- memhotplug/arch/sh64/mm/init.c~A6-no_arch_mem_map_init 2005-02-04 15:21:57.000000000 -0800
+++ memhotplug-dave/arch/sh64/mm/init.c 2005-02-04 15:21:57.000000000 -0800
@@ -124,9 +124,6 @@ void __init paging_init(void)
zones_size[ZONE_DMA] = MAX_LOW_PFN - START_PFN;
NODE_DATA(0)->node_mem_map = NULL;
free_area_init_node(0, NODE_DATA(0), zones_size, __MEMORY_START >> PAGE_SHIFT, 0);
-
- /* XXX: MRB-remove - this doesn't seem sane, should this be done somewhere else ?*/
- mem_map = NODE_DATA(0)->node_mem_map;
}
void __init mem_init(void)
diff -puN arch/sparc/mm/srmmu.c~A6-no_arch_mem_map_init arch/sparc/mm/srmmu.c
--- memhotplug/arch/sparc/mm/srmmu.c~A6-no_arch_mem_map_init 2005-02-04 15:21:57.000000000 -0800
+++ memhotplug-dave/arch/sparc/mm/srmmu.c 2005-02-04 15:21:57.000000000 -0800
@@ -1343,7 +1343,6 @@ void __init srmmu_paging_init(void)
free_area_init_node(0, &contig_page_data, zones_size,
pfn_base, zholes_size);
- mem_map = contig_page_data.node_mem_map;
}
}
diff -puN arch/sparc/mm/sun4c.c~A6-no_arch_mem_map_init arch/sparc/mm/sun4c.c
--- memhotplug/arch/sparc/mm/sun4c.c~A6-no_arch_mem_map_init 2005-02-04 15:21:57.000000000 -0800
+++ memhotplug-dave/arch/sparc/mm/sun4c.c 2005-02-04 15:21:57.000000000 -0800
@@ -2116,7 +2116,6 @@ void __init sun4c_paging_init(void)
free_area_init_node(0, &contig_page_data, zones_size,
pfn_base, zholes_size);
- mem_map = contig_page_data.node_mem_map;
}
cnt = 0;
diff -puN arch/sparc64/mm/init.c~A6-no_arch_mem_map_init arch/sparc64/mm/init.c
--- memhotplug/arch/sparc64/mm/init.c~A6-no_arch_mem_map_init 2005-02-04 15:21:57.000000000 -0800
+++ memhotplug-dave/arch/sparc64/mm/init.c 2005-02-04 15:21:57.000000000 -0800
@@ -1512,7 +1512,6 @@ void __init paging_init(void)
free_area_init_node(0, &contig_page_data, zones_size,
phys_base >> PAGE_SHIFT, zholes_size);
- mem_map = contig_page_data.node_mem_map;
}
device_scan();
diff -puN arch/v850/kernel/setup.c~A6-no_arch_mem_map_init arch/v850/kernel/setup.c
--- memhotplug/arch/v850/kernel/setup.c~A6-no_arch_mem_map_init 2005-02-04 15:21:57.000000000 -0800
+++ memhotplug-dave/arch/v850/kernel/setup.c 2005-02-04 15:21:57.000000000 -0800
@@ -283,5 +283,4 @@ init_mem_alloc (unsigned long ram_start,
NODE_DATA(0)->node_mem_map = NULL;
free_area_init_node (0, NODE_DATA(0), zones_size,
ADDR_TO_PAGE (PAGE_OFFSET), 0);
- mem_map = NODE_DATA(0)->node_mem_map;
}
diff -puN mm/page_alloc.c~A6-no_arch_mem_map_init mm/page_alloc.c
--- memhotplug/mm/page_alloc.c~A6-no_arch_mem_map_init 2005-02-04 15:21:57.000000000 -0800
+++ memhotplug-dave/mm/page_alloc.c 2005-02-08 09:59:02.000000000 -0800
@@ -1848,14 +1848,25 @@ static void __init free_area_init_core(s
}
}
-void __init node_alloc_mem_map(struct pglist_data *pgdat)
+static void __init alloc_node_mem_map(struct pglist_data *pgdat)
{
unsigned long size;
+ /*
+ * Make sure that the architecture hasn't already allocated
+ * a node_mem_map, and that the node contains memory.
+ */
+ if (pgdat->node_mem_map || !pgdat->node_spanned_pages)
+ return;
+
size = (pgdat->node_spanned_pages + 1) * sizeof(struct page);
pgdat->node_mem_map = alloc_bootmem_node(pgdat, size);
#ifndef CONFIG_DISCONTIGMEM
- mem_map = contig_page_data.node_mem_map;
+ /*
+ * With no DISCONTIG, the global mem_map is just set as node 0's
+ */
+ if (pgdat == NODE_DATA(0))
+ mem_map = NODE_DATA(0)->node_mem_map;
#endif
}
@@ -1867,8 +1878,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))
- node_alloc_mem_map(pgdat);
+ alloc_node_mem_map(pgdat);
free_area_init_core(pgdat, zones_size, zholes_size);
}
diff -puN arch/i386/kernel/mpparse.c~A6-no_arch_mem_map_init arch/i386/kernel/mpparse.c
diff -puN arch/i386/kernel/setup.c~A6-no_arch_mem_map_init arch/i386/kernel/setup.c
diff -puN arch/m32r/mm/init.c~A6-no_arch_mem_map_init arch/m32r/mm/init.c
--- memhotplug/arch/m32r/mm/init.c~A6-no_arch_mem_map_init 2005-02-08 10:06:45.000000000 -0800
+++ memhotplug-dave/arch/m32r/mm/init.c 2005-02-08 10:06:55.000000000 -0800
@@ -121,8 +121,6 @@ unsigned long __init zone_sizes_init(voi
free_area_init_node(0, NODE_DATA(0), zones_size, start_pfn, 0);
- mem_map = contig_page_data.node_mem_map;
-
return 0;
}
#else /* CONFIG_DISCONTIGMEM */
diff -puN arch/um/kernel/physmem.c~A6-no_arch_mem_map_init arch/um/kernel/physmem.c
--- memhotplug/arch/um/kernel/physmem.c~A6-no_arch_mem_map_init 2005-02-08 11:14:20.000000000 -0800
+++ memhotplug-dave/arch/um/kernel/physmem.c 2005-02-08 11:14:31.000000000 -0800
@@ -294,7 +294,6 @@ int init_maps(unsigned long physmem, uns
INIT_LIST_HEAD(&p->lru);
}
- mem_map = map;
max_mapnr = total_pages;
return(0);
}
_
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Lhms-devel] [RFC][PATCH] no per-arch mem_map init
2005-02-08 19:37 [RFC][PATCH] no per-arch mem_map init Dave Hansen
@ 2005-02-09 0:39 ` Yasunori Goto
2005-02-09 1:14 ` Dave Hansen
2005-02-09 1:04 ` Bob Picco
1 sibling, 1 reply; 6+ messages in thread
From: Yasunori Goto @ 2005-02-09 0:39 UTC (permalink / raw)
To: Dave Hansen; +Cc: lhms, Jesse Barnes, Bob Picco, linux-mm
Hi Dave-san.
> This patch has been one of the base patches in the -mhp tree for a bit
> now, and seems to be working pretty well, at least on x86. I would like
> to submit it upstream, but I want to get a bit more testing first. Is
> there a chance you ia64 guys could give it a quick test boot to make
> sure that it doesn't screw you over?
I tried this single patch with 2.6.11-rc2-mm2 on my Tiger4, and
there is no problem in booting. In addition, I compliled other
kernel as simple workload test on this test kernel, I didn't find
any problem.
Bye.
--
Yasunori Goto <ygoto at us.fujitsu.com>
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"aart@kvack.org"> aart@kvack.org </a>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [RFC][PATCH] no per-arch mem_map init
2005-02-08 19:37 [RFC][PATCH] no per-arch mem_map init Dave Hansen
2005-02-09 0:39 ` [Lhms-devel] " Yasunori Goto
@ 2005-02-09 1:04 ` Bob Picco
2005-02-09 1:17 ` Dave Hansen
1 sibling, 1 reply; 6+ messages in thread
From: Bob Picco @ 2005-02-09 1:04 UTC (permalink / raw)
To: Dave Hansen; +Cc: lhms, Jesse Barnes, Bob Picco, linux-mm
Dave,
Dave Hansen wrote: [Tue Feb 08 2005, 02:37:14PM EST]
> This patch has been one of the base patches in the -mhp tree for a bit
> now, and seems to be working pretty well, at least on x86. I would like
> to submit it upstream, but I want to get a bit more testing first. Is
> there a chance you ia64 guys could give it a quick test boot to make
> sure that it doesn't screw you over?
>
> -- Dave
[snip]
> diff -puN arch/i386/mm/discontig.c~A6-no_arch_mem_map_init arch/i386/mm/discontig.c
> diff -puN arch/ia64/mm/contig.c~A6-no_arch_mem_map_init arch/ia64/mm/contig.c
> --- memhotplug/arch/ia64/mm/contig.c~A6-no_arch_mem_map_init 2005-02-04 15:21:57.000000000 -0800
> +++ memhotplug-dave/arch/ia64/mm/contig.c 2005-02-04 15:21:57.000000000 -0800
> @@ -280,7 +280,7 @@ paging_init (void)
> 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;
> + NODE_DATA(0)->node_mem_map = vmem_map;
This has to be changed to.
mem_map = NODE_DATA(0)->node_mem_map = vmem_map;
> free_area_init_node(0, &contig_page_data, zones_size,
> 0, zholes_size);
>
[snip]
I actually submitted an identical change within my last patchset to lhms.
Not making this change requires changing use of mem_map throughout contig.c
and one BUG assertion in init.c. I haven't tested this patch but it was
indirectly tested by me in FLATMEM configuration for lhms.
bob
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"aart@kvack.org"> aart@kvack.org </a>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Lhms-devel] [RFC][PATCH] no per-arch mem_map init
2005-02-09 0:39 ` [Lhms-devel] " Yasunori Goto
@ 2005-02-09 1:14 ` Dave Hansen
0 siblings, 0 replies; 6+ messages in thread
From: Dave Hansen @ 2005-02-09 1:14 UTC (permalink / raw)
To: Yasunori Goto; +Cc: lhms, Jesse Barnes, Bob Picco, linux-mm
On Tue, 2005-02-08 at 16:39 -0800, Yasunori Goto wrote:
> Hi Dave-san.
>
> > This patch has been one of the base patches in the -mhp tree for a bit
> > now, and seems to be working pretty well, at least on x86. I would like
> > to submit it upstream, but I want to get a bit more testing first. Is
> > there a chance you ia64 guys could give it a quick test boot to make
> > sure that it doesn't screw you over?
>
> I tried this single patch with 2.6.11-rc2-mm2 on my Tiger4, and
> there is no problem in booting. In addition, I compliled other
> kernel as simple workload test on this test kernel, I didn't find
> any problem.
Thanks for the testing!
-- Dave
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"aart@kvack.org"> aart@kvack.org </a>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [RFC][PATCH] no per-arch mem_map init
2005-02-09 1:04 ` Bob Picco
@ 2005-02-09 1:17 ` Dave Hansen
2005-02-09 1:46 ` Bob Picco
0 siblings, 1 reply; 6+ messages in thread
From: Dave Hansen @ 2005-02-09 1:17 UTC (permalink / raw)
To: Bob Picco; +Cc: lhms, Jesse Barnes, linux-mm
On Tue, 2005-02-08 at 20:04 -0500, Bob Picco wrote:
> > - mem_map = contig_page_data.node_mem_map = vmem_map;
> > + NODE_DATA(0)->node_mem_map = vmem_map;
> This has to be changed to.
> mem_map = NODE_DATA(0)->node_mem_map = vmem_map;
> > free_area_init_node(0, &contig_page_data, zones_size,
> > 0, zholes_size);
> >
> [snip]
> I actually submitted an identical change within my last patchset to lhms.
Good to know. I hadn't actually noticed that bit in your patch. It's
another good example why to split things up into as many small, logical
pieces as possible.
> Not making this change requires changing use of mem_map throughout contig.c
> and one BUG assertion in init.c. I haven't tested this patch but it was
> indirectly tested by me in FLATMEM configuration for lhms.
Hmm. Do you really need the 'mem_map = ' part? I *think*
free_area_init_node() calls alloc_node_mem_map(), which should do that
exact assignment for you.
-- Dave
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"aart@kvack.org"> aart@kvack.org </a>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [RFC][PATCH] no per-arch mem_map init
2005-02-09 1:17 ` Dave Hansen
@ 2005-02-09 1:46 ` Bob Picco
0 siblings, 0 replies; 6+ messages in thread
From: Bob Picco @ 2005-02-09 1:46 UTC (permalink / raw)
To: Dave Hansen; +Cc: Bob Picco, lhms, Jesse Barnes, linux-mm
Dave Hansen wrote: [Tue Feb 08 2005, 08:17:30PM EST]
> On Tue, 2005-02-08 at 20:04 -0500, Bob Picco wrote:
> > > - mem_map = contig_page_data.node_mem_map = vmem_map;
> > > + NODE_DATA(0)->node_mem_map = vmem_map;
> > This has to be changed to.
> > mem_map = NODE_DATA(0)->node_mem_map = vmem_map;
> > > free_area_init_node(0, &contig_page_data, zones_size,
> > > 0, zholes_size);
> > >
> > [snip]
> > I actually submitted an identical change within my last patchset to lhms.
>
> Good to know. I hadn't actually noticed that bit in your patch. It's
> another good example why to split things up into as many small, logical
> pieces as possible.
>
> > Not making this change requires changing use of mem_map throughout contig.c
> > and one BUG assertion in init.c. I haven't tested this patch but it was
> > indirectly tested by me in FLATMEM configuration for lhms.
>
> Hmm. Do you really need the 'mem_map = ' part? I *think*
> free_area_init_node() calls alloc_node_mem_map(), which should do that
> exact assignment for you.
>
> -- Dave
okay. I see what happened here. alloc_node_mem_map is correct and makes my
suggested change not required. I think this was fallout from our bad composite
lhms patchset.
bob
>
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"aart@kvack.org"> aart@kvack.org </a>
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2005-02-09 1:46 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-02-08 19:37 [RFC][PATCH] no per-arch mem_map init Dave Hansen
2005-02-09 0:39 ` [Lhms-devel] " Yasunori Goto
2005-02-09 1:14 ` Dave Hansen
2005-02-09 1:04 ` Bob Picco
2005-02-09 1:17 ` Dave Hansen
2005-02-09 1:46 ` Bob Picco
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox