* [PATCH] don't pass mem_map into init functions
@ 2004-07-28 20:55 Dave Hansen
2004-07-28 21:58 ` Jesse Barnes
2004-07-28 22:01 ` Jesse Barnes
0 siblings, 2 replies; 15+ messages in thread
From: Dave Hansen @ 2004-07-28 20:55 UTC (permalink / raw)
To: Martin J. Bligh
Cc: linux-mm, LSE, Jesse Barnes, Anton Blanchard,
Linux Kernel Mailing List
[-- Attachment #1: Type: text/plain, Size: 2115 bytes --]
When using CONFIG_NONLINEAR, a zone's mem_map isn't contiguous, and
isn't allocated in the same place. This means that nonlinear doesn't
really have a mem_map[] to pass into free_area_init_node() or
memmap_init_zone() which makes any sense.
So, this patch removes the 'struct page *mem_map' argument to both of
those functions. All non-NUMA architectures just pass a NULL in there,
which is ignored. I've cc'd any NUMA architecture's maintainer who's
code I've touched.
To replace the removed arguments, a call to pfn_to_page(node_start_pfn)
is made. This is valid because all of the pfn_to_page() implementations
rely only on the pgdats, which are already set up at this time. Plus,
the pfn_to_page() method should work for any future nonlinear-type
code.
Finally, the patch creates a function: node_alloc_mem_map(), which I
plan to effectively #ifdef out for nonlinear at some future date.
Compile tested on SMP x86 and NUMAQ. I plan to give it a run on ppc64
in a bit. I'd appreciate if one of the ia64 guys could make sure it's
OK for them as well.
arch/alpha/mm/numa.c | 2 +-
arch/arm/mm/init.c | 2 +-
arch/arm26/mm/init.c | 2 +-
arch/cris/arch-v10/mm/init.c | 2 +-
arch/i386/mm/discontig.c | 6 +++---
arch/ia64/mm/contig.c | 5 +++--
arch/ia64/mm/discontig.c | 4 ++--
arch/ia64/mm/init.c | 4 ++--
arch/mips/sgi-ip27/ip27-memory.c | 2 +-
arch/parisc/mm/init.c | 2 +-
arch/ppc64/mm/init.c | 2 +-
arch/ppc64/mm/numa.c | 5 +++--
arch/sh/mm/init.c | 4 ++--
arch/sh64/mm/init.c | 2 +-
arch/sparc/mm/srmmu.c | 2 +-
arch/sparc/mm/sun4c.c | 2 +-
arch/sparc64/mm/init.c | 2 +-
arch/v850/kernel/setup.c | 2 +-
arch/x86_64/mm/numa.c | 2 +-
include/linux/mm.h | 4 ++--
mm/page_alloc.c | 37 ++++++++++++++++++++-----------------
21 files changed, 50 insertions(+), 45 deletions(-)
-- Dave
[-- Attachment #2: init-time-no-mem_map-2.6.8-rc2-mm1-0.patch --]
[-- Type: text/x-patch, Size: 15896 bytes --]
diff -ru C-create-__boot-ppc64/arch/alpha/mm/numa.c D-init-no-mem_map/arch/alpha/mm/numa.c
--- C-create-__boot-ppc64/arch/alpha/mm/numa.c 2004-07-28 11:33:39.000000000 -0700
+++ D-init-no-mem_map/arch/alpha/mm/numa.c 2004-07-28 11:52:55.000000000 -0700
@@ -313,7 +313,7 @@
zones_size[ZONE_DMA] = dma_local_pfn;
zones_size[ZONE_NORMAL] = (end_pfn - start_pfn) - dma_local_pfn;
}
- free_area_init_node(nid, NODE_DATA(nid), NULL, zones_size, start_pfn, NULL);
+ free_area_init_node(nid, NODE_DATA(nid), zones_size, start_pfn, NULL);
}
/* Initialize the kernel's ZERO_PGE. */
diff -ru C-create-__boot-ppc64/arch/arm/mm/init.c D-init-no-mem_map/arch/arm/mm/init.c
--- C-create-__boot-ppc64/arch/arm/mm/init.c 2004-07-28 11:33:39.000000000 -0700
+++ D-init-no-mem_map/arch/arm/mm/init.c 2004-07-28 11:53:09.000000000 -0700
@@ -502,7 +502,7 @@
*/
arch_adjust_zones(node, zone_size, zhole_size);
- free_area_init_node(node, pgdat, 0, zone_size,
+ free_area_init_node(node, pgdat, zone_size,
bdata->node_boot_start >> PAGE_SHIFT, zhole_size);
}
diff -ru C-create-__boot-ppc64/arch/arm26/mm/init.c D-init-no-mem_map/arch/arm26/mm/init.c
--- C-create-__boot-ppc64/arch/arm26/mm/init.c 2004-07-28 11:33:39.000000000 -0700
+++ D-init-no-mem_map/arch/arm26/mm/init.c 2004-07-28 11:53:14.000000000 -0700
@@ -306,7 +306,7 @@
if (!zone_size[0])
BUG();
- free_area_init_node(0, pgdat, 0, zone_size,
+ free_area_init_node(0, pgdat, zone_size,
bdata->node_boot_start >> PAGE_SHIFT, zhole_size);
mem_map = NODE_DATA(0)->node_mem_map;
diff -ru C-create-__boot-ppc64/arch/cris/arch-v10/mm/init.c D-init-no-mem_map/arch/cris/arch-v10/mm/init.c
--- C-create-__boot-ppc64/arch/cris/arch-v10/mm/init.c 2004-07-28 11:33:39.000000000 -0700
+++ D-init-no-mem_map/arch/cris/arch-v10/mm/init.c 2004-07-28 11:53:20.000000000 -0700
@@ -183,7 +183,7 @@
* mem_map page array.
*/
- free_area_init_node(0, &contig_page_data, 0, zones_size, PAGE_OFFSET >> PAGE_SHIFT, 0);
+ free_area_init_node(0, &contig_page_data, zones_size, PAGE_OFFSET >> PAGE_SHIFT, 0);
mem_map = contig_page_data.node_mem_map;
}
diff -ru C-create-__boot-ppc64/arch/i386/mm/discontig.c D-init-no-mem_map/arch/i386/mm/discontig.c
--- C-create-__boot-ppc64/arch/i386/mm/discontig.c 2004-07-28 11:33:38.000000000 -0700
+++ D-init-no-mem_map/arch/i386/mm/discontig.c 2004-07-28 13:19:18.000000000 -0700
@@ -418,16 +418,16 @@
* remapped KVA area - mbligh
*/
if (!nid)
- free_area_init_node(nid, NODE_DATA(nid), 0,
+ free_area_init_node(nid, NODE_DATA(nid),
zones_size, start, zholes_size);
else {
unsigned long lmem_map;
lmem_map = (unsigned long)node_remap_start_vaddr[nid];
lmem_map += sizeof(pg_data_t) + PAGE_SIZE - 1;
lmem_map &= PAGE_MASK;
+ NODE_DATA(nid)->node_mem_map = (struct page *)lmem_map;
free_area_init_node(nid, NODE_DATA(nid),
- (struct page *)lmem_map, zones_size,
- start, zholes_size);
+ zones_size, start, zholes_size);
}
}
return;
diff -ru C-create-__boot-ppc64/arch/ia64/mm/contig.c D-init-no-mem_map/arch/ia64/mm/contig.c
--- C-create-__boot-ppc64/arch/ia64/mm/contig.c 2004-07-28 11:33:39.000000000 -0700
+++ D-init-no-mem_map/arch/ia64/mm/contig.c 2004-07-28 11:56:35.000000000 -0700
@@ -267,7 +267,7 @@
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, NULL, zones_size, 0,
+ free_area_init_node(0, &contig_page_data, zones_size, 0,
zholes_size);
mem_map = contig_page_data.node_mem_map;
} else {
@@ -280,7 +280,8 @@
vmem_map = (struct page *) vmalloc_end;
efi_memmap_walk(create_mem_map_page_table, 0);
- free_area_init_node(0, &contig_page_data, vmem_map, zones_size,
+ contig_page_data.node_mem_map = vmem_map;
+ free_area_init_node(0, &contig_page_data, zones_size,
0, zholes_size);
mem_map = contig_page_data.node_mem_map;
diff -ru C-create-__boot-ppc64/arch/ia64/mm/discontig.c D-init-no-mem_map/arch/ia64/mm/discontig.c
--- C-create-__boot-ppc64/arch/ia64/mm/discontig.c 2004-07-28 11:33:39.000000000 -0700
+++ D-init-no-mem_map/arch/ia64/mm/discontig.c 2004-07-28 12:33:40.000000000 -0700
@@ -665,8 +665,8 @@
pfn_offset = mem_data[node].min_pfn;
- free_area_init_node(node, NODE_DATA(node),
- vmem_map + pfn_offset, zones_size,
+ 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 -ru C-create-__boot-ppc64/arch/ia64/mm/init.c D-init-no-mem_map/arch/ia64/mm/init.c
--- C-create-__boot-ppc64/arch/ia64/mm/init.c 2004-07-28 11:33:39.000000000 -0700
+++ D-init-no-mem_map/arch/ia64/mm/init.c 2004-07-28 12:55:16.000000000 -0700
@@ -427,7 +427,7 @@
/ sizeof(struct page));
if (map_start < map_end)
- memmap_init_zone(map_start, (unsigned long) (map_end - map_start),
+ memmap_init_zone((unsigned long) (map_end - map_start),
args->nid, args->zone, page_to_pfn(map_start));
return 0;
}
@@ -437,7 +437,7 @@
unsigned long zone, unsigned long start_pfn)
{
if (!vmem_map)
- memmap_init_zone(start, size, nid, zone, start_pfn);
+ memmap_init_zone(size, nid, zone, start_pfn);
else {
struct memmap_init_callback_data args;
diff -ru C-create-__boot-ppc64/arch/mips/sgi-ip27/ip27-memory.c D-init-no-mem_map/arch/mips/sgi-ip27/ip27-memory.c
--- C-create-__boot-ppc64/arch/mips/sgi-ip27/ip27-memory.c 2004-07-28 11:33:39.000000000 -0700
+++ D-init-no-mem_map/arch/mips/sgi-ip27/ip27-memory.c 2004-07-28 11:57:35.000000000 -0700
@@ -225,7 +225,7 @@
pfn_t end_pfn = node_getmaxclick(node) + 1;
zones_size[ZONE_DMA] = end_pfn - start_pfn;
- free_area_init_node(node, NODE_DATA(node), NULL,
+ free_area_init_node(node, NODE_DATA(node),
zones_size, start_pfn, NULL);
if (end_pfn > max_low_pfn)
diff -ru C-create-__boot-ppc64/arch/parisc/mm/init.c D-init-no-mem_map/arch/parisc/mm/init.c
--- C-create-__boot-ppc64/arch/parisc/mm/init.c 2004-07-28 11:33:39.000000000 -0700
+++ D-init-no-mem_map/arch/parisc/mm/init.c 2004-07-28 11:57:42.000000000 -0700
@@ -761,7 +761,7 @@
unsigned long zones_size[MAX_NR_ZONES] = { 0, 0, 0, };
zones_size[ZONE_DMA] = pmem_ranges[i].pages;
- free_area_init_node(i,NODE_DATA(i),NULL,zones_size,
+ free_area_init_node(i,NODE_DATA(i),zones_size,
(pmem_ranges[i].start_pfn << PAGE_SHIFT),0);
}
diff -ru C-create-__boot-ppc64/arch/ppc64/mm/init.c D-init-no-mem_map/arch/ppc64/mm/init.c
--- C-create-__boot-ppc64/arch/ppc64/mm/init.c 2004-07-28 11:33:39.000000000 -0700
+++ D-init-no-mem_map/arch/ppc64/mm/init.c 2004-07-28 11:57:47.000000000 -0700
@@ -587,7 +587,7 @@
zones_size[ZONE_DMA] = top_of_ram >> PAGE_SHIFT;
zholes_size[ZONE_DMA] = (top_of_ram - total_ram) >> PAGE_SHIFT;
- free_area_init_node(0, &contig_page_data, NULL, zones_size,
+ 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;
}
diff -ru C-create-__boot-ppc64/arch/ppc64/mm/numa.c D-init-no-mem_map/arch/ppc64/mm/numa.c
--- C-create-__boot-ppc64/arch/ppc64/mm/numa.c 2004-07-28 11:33:39.000000000 -0700
+++ D-init-no-mem_map/arch/ppc64/mm/numa.c 2004-07-28 11:58:29.000000000 -0700
@@ -474,7 +474,8 @@
else
node_mem_map = NULL;
- free_area_init_node(nid, NODE_DATA(nid), node_mem_map,
- zones_size, start_pfn, zholes_size);
+ NODE_DATA(nid)->node_mem_map = node_mem_map;
+ free_area_init_node(nid, NODE_DATA(nid), zones_size,
+ start_pfn, zholes_size);
}
}
diff -ru C-create-__boot-ppc64/arch/sh/mm/init.c D-init-no-mem_map/arch/sh/mm/init.c
--- C-create-__boot-ppc64/arch/sh/mm/init.c 2004-07-28 11:33:39.000000000 -0700
+++ D-init-no-mem_map/arch/sh/mm/init.c 2004-07-28 11:59:25.000000000 -0700
@@ -215,7 +215,7 @@
disable_mmu();
#endif
- free_area_init_node(0, NODE_DATA(0), 0, zones_size, __MEMORY_START >> PAGE_SHIFT, 0);
+ 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;
@@ -225,7 +225,7 @@
*/
zones_size[ZONE_DMA] = __MEMORY_SIZE_2ND >> PAGE_SHIFT;
zones_size[ZONE_NORMAL] = 0;
- free_area_init_node(1, NODE_DATA(1), 0, zones_size, __MEMORY_START_2ND >> PAGE_SHIFT, 0);
+ free_area_init_node(1, NODE_DATA(1), zones_size, __MEMORY_START_2ND >> PAGE_SHIFT, 0);
#endif
}
diff -ru C-create-__boot-ppc64/arch/sh64/mm/init.c D-init-no-mem_map/arch/sh64/mm/init.c
--- C-create-__boot-ppc64/arch/sh64/mm/init.c 2004-07-28 11:33:39.000000000 -0700
+++ D-init-no-mem_map/arch/sh64/mm/init.c 2004-07-28 11:59:29.000000000 -0700
@@ -123,7 +123,7 @@
*/
zones_size[ZONE_DMA] = MAX_LOW_PFN - START_PFN;
- free_area_init_node(0, NODE_DATA(0), 0, zones_size, __MEMORY_START >> PAGE_SHIFT, 0);
+ 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;
diff -ru C-create-__boot-ppc64/arch/sparc/mm/srmmu.c D-init-no-mem_map/arch/sparc/mm/srmmu.c
--- C-create-__boot-ppc64/arch/sparc/mm/srmmu.c 2004-07-28 11:33:39.000000000 -0700
+++ D-init-no-mem_map/arch/sparc/mm/srmmu.c 2004-07-28 11:59:34.000000000 -0700
@@ -1341,7 +1341,7 @@
zones_size[ZONE_HIGHMEM] = npages;
zholes_size[ZONE_HIGHMEM] = npages - calc_highpages();
- free_area_init_node(0, &contig_page_data, NULL, zones_size,
+ free_area_init_node(0, &contig_page_data, zones_size,
pfn_base, zholes_size);
mem_map = contig_page_data.node_mem_map;
}
diff -ru C-create-__boot-ppc64/arch/sparc/mm/sun4c.c D-init-no-mem_map/arch/sparc/mm/sun4c.c
--- C-create-__boot-ppc64/arch/sparc/mm/sun4c.c 2004-07-28 11:33:39.000000000 -0700
+++ D-init-no-mem_map/arch/sparc/mm/sun4c.c 2004-07-28 11:59:40.000000000 -0700
@@ -2114,7 +2114,7 @@
zones_size[ZONE_HIGHMEM] = npages;
zholes_size[ZONE_HIGHMEM] = npages - calc_highpages();
- free_area_init_node(0, &contig_page_data, NULL, zones_size,
+ free_area_init_node(0, &contig_page_data, zones_size,
pfn_base, zholes_size);
mem_map = contig_page_data.node_mem_map;
}
diff -ru C-create-__boot-ppc64/arch/sparc64/mm/init.c D-init-no-mem_map/arch/sparc64/mm/init.c
--- C-create-__boot-ppc64/arch/sparc64/mm/init.c 2004-07-28 11:33:38.000000000 -0700
+++ D-init-no-mem_map/arch/sparc64/mm/init.c 2004-07-28 11:59:45.000000000 -0700
@@ -1585,7 +1585,7 @@
zones_size[ZONE_DMA] = npages;
zholes_size[ZONE_DMA] = npages - pages_avail;
- free_area_init_node(0, &contig_page_data, NULL, zones_size,
+ free_area_init_node(0, &contig_page_data, zones_size,
phys_base >> PAGE_SHIFT, zholes_size);
mem_map = contig_page_data.node_mem_map;
}
diff -ru C-create-__boot-ppc64/arch/v850/kernel/setup.c D-init-no-mem_map/arch/v850/kernel/setup.c
--- C-create-__boot-ppc64/arch/v850/kernel/setup.c 2004-07-28 11:33:39.000000000 -0700
+++ D-init-no-mem_map/arch/v850/kernel/setup.c 2004-07-28 11:59:49.000000000 -0700
@@ -281,7 +281,7 @@
#error MAX_ORDER is too large for given PAGE_OFFSET (use CONFIG_FORCE_MAX_ZONEORDER to change it)
#endif
- free_area_init_node (0, NODE_DATA(0), 0, zones_size,
+ 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 -ru C-create-__boot-ppc64/arch/x86_64/mm/numa.c D-init-no-mem_map/arch/x86_64/mm/numa.c
--- C-create-__boot-ppc64/arch/x86_64/mm/numa.c 2004-07-28 11:33:39.000000000 -0700
+++ D-init-no-mem_map/arch/x86_64/mm/numa.c 2004-07-28 11:59:54.000000000 -0700
@@ -136,7 +136,7 @@
zones[ZONE_NORMAL] = end_pfn - start_pfn;
}
- free_area_init_node(nodeid, NODE_DATA(nodeid), NULL, zones,
+ free_area_init_node(nodeid, NODE_DATA(nodeid), zones,
start_pfn, NULL);
}
diff -ru C-create-__boot-ppc64/include/linux/mm.h D-init-no-mem_map/include/linux/mm.h
--- C-create-__boot-ppc64/include/linux/mm.h 2004-07-28 11:33:42.000000000 -0700
+++ D-init-no-mem_map/include/linux/mm.h 2004-07-28 13:24:32.000000000 -0700
@@ -588,10 +588,10 @@
}
extern void free_area_init(unsigned long * zones_size);
-extern void free_area_init_node(int nid, pg_data_t *pgdat, struct page *pmap,
+extern void free_area_init_node(int nid, pg_data_t *pgdat,
unsigned long * zones_size, unsigned long zone_start_pfn,
unsigned long *zholes_size);
-extern void memmap_init_zone(struct page *, unsigned long, int,
+extern void memmap_init_zone(unsigned long, int,
unsigned long, unsigned long);
extern void mem_init(void);
extern void show_mem(void);
diff -ru C-create-__boot-ppc64/mm/page_alloc.c D-init-no-mem_map/mm/page_alloc.c
--- C-create-__boot-ppc64/mm/page_alloc.c 2004-07-28 11:33:43.000000000 -0700
+++ D-init-no-mem_map/mm/page_alloc.c 2004-07-28 12:56:26.000000000 -0700
@@ -1396,11 +1396,12 @@
* up by free_all_bootmem() once the early boot process is
* done. Non-atomic initialization, single-pass.
*/
-void __init memmap_init_zone(struct page *start, unsigned long size, int nid,
+void __init memmap_init_zone(unsigned long size, int nid,
unsigned long zone, unsigned long start_pfn)
{
- struct page *page;
+ struct page *page, *start;
+ start = pfn_to_page(start_pfn);
for (page = start; page < (start + size); page++) {
set_page_zone(page, NODEZONE(nid, zone));
set_page_count(page, 0);
@@ -1462,8 +1463,8 @@
}
#ifndef __HAVE_ARCH_MEMMAP_INIT
-#define memmap_init(start, size, nid, zone, start_pfn) \
- memmap_init_zone((start), (size), (nid), (zone), (start_pfn))
+#define memmap_init(size, nid, zone, start_pfn) \
+ memmap_init_zone((size), (nid), (zone), (start_pfn))
#endif
/*
@@ -1478,7 +1479,6 @@
unsigned long i, j;
const unsigned long zone_required_alignment = 1UL << (MAX_ORDER-1);
int cpu, nid = pgdat->node_id;
- struct page *lmem_map = pgdat->node_mem_map;
unsigned long zone_start_pfn = pgdat->node_start_pfn;
pgdat->nr_zones = 0;
@@ -1566,35 +1566,38 @@
pgdat->nr_zones = j+1;
- zone->zone_mem_map = lmem_map;
+ zone->zone_mem_map = pfn_to_page(zone_start_pfn);
zone->zone_start_pfn = zone_start_pfn;
if ((zone_start_pfn) & (zone_required_alignment-1))
printk("BUG: wrong zone alignment, it will crash\n");
- memmap_init(lmem_map, size, nid, j, zone_start_pfn);
+ memmap_init(size, nid, j, zone_start_pfn);
zone_start_pfn += size;
- lmem_map += size;
zone_init_free_lists(pgdat, zone, zone->spanned_pages);
}
}
-void __init free_area_init_node(int nid, struct pglist_data *pgdat,
- struct page *node_mem_map, unsigned long *zones_size,
- unsigned long node_start_pfn, unsigned long *zholes_size)
+void __init node_alloc_mem_map(struct pglist_data *pgdat)
{
unsigned long size;
+ size = (pgdat->node_spanned_pages + 1) * sizeof(struct page);
+ pgdat->node_mem_map = alloc_bootmem_node(pgdat, size);
+}
+
+void __init free_area_init_node(int nid, struct pglist_data *pgdat,
+ unsigned long *zones_size, unsigned long node_start_pfn,
+ unsigned long *zholes_size)
+{
pgdat->node_id = nid;
pgdat->node_start_pfn = node_start_pfn;
calculate_zone_totalpages(pgdat, zones_size, zholes_size);
- if (!node_mem_map) {
- size = (pgdat->node_spanned_pages + 1) * sizeof(struct page);
- node_mem_map = alloc_bootmem_node(pgdat, size);
- }
- pgdat->node_mem_map = node_mem_map;
+
+ if (!pfn_to_page(node_start_pfn))
+ node_alloc_mem_map(pgdat);
free_area_init_core(pgdat, zones_size, zholes_size);
}
@@ -1607,7 +1610,7 @@
void __init free_area_init(unsigned long *zones_size)
{
- free_area_init_node(0, &contig_page_data, NULL, zones_size,
+ free_area_init_node(0, &contig_page_data, zones_size,
__pa(PAGE_OFFSET) >> PAGE_SHIFT, NULL);
mem_map = contig_page_data.node_mem_map;
}
^ permalink raw reply [flat|nested] 15+ messages in thread* Re: [PATCH] don't pass mem_map into init functions
2004-07-28 20:55 [PATCH] don't pass mem_map into init functions Dave Hansen
@ 2004-07-28 21:58 ` Jesse Barnes
2004-07-28 22:01 ` Jesse Barnes
1 sibling, 0 replies; 15+ messages in thread
From: Jesse Barnes @ 2004-07-28 21:58 UTC (permalink / raw)
To: Dave Hansen
Cc: Martin J. Bligh, linux-mm, LSE, Anton Blanchard,
Linux Kernel Mailing List
On Wednesday, July 28, 2004 1:55 pm, Dave Hansen wrote:
> Compile tested on SMP x86 and NUMAQ. I plan to give it a run on ppc64
> in a bit. I'd appreciate if one of the ia64 guys could make sure it's
> OK for them as well.
It *looks* ok. I'll give it a whirl to make sure.
Jesse
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH] don't pass mem_map into init functions
2004-07-28 20:55 [PATCH] don't pass mem_map into init functions Dave Hansen
2004-07-28 21:58 ` Jesse Barnes
@ 2004-07-28 22:01 ` Jesse Barnes
2004-07-28 22:19 ` Dave Hansen
1 sibling, 1 reply; 15+ messages in thread
From: Jesse Barnes @ 2004-07-28 22:01 UTC (permalink / raw)
To: Dave Hansen
Cc: Martin J. Bligh, linux-mm, LSE, Anton Blanchard,
Linux Kernel Mailing List
On Wednesday, July 28, 2004 1:55 pm, Dave Hansen wrote:
> Compile tested on SMP x86 and NUMAQ. I plan to give it a run on ppc64
> in a bit. I'd appreciate if one of the ia64 guys could make sure it's
> OK for them as well.
Which tree is this against? It doesn't apply to the bk tree or
linux-2.6.8-rc2-mm1.
Thanks,
Jesse
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH] don't pass mem_map into init functions
2004-07-28 22:01 ` Jesse Barnes
@ 2004-07-28 22:19 ` Dave Hansen
2004-07-28 22:39 ` Jesse Barnes
0 siblings, 1 reply; 15+ messages in thread
From: Dave Hansen @ 2004-07-28 22:19 UTC (permalink / raw)
To: Jesse Barnes
Cc: Martin J. Bligh, linux-mm, LSE, Anton Blanchard,
Linux Kernel Mailing List
[-- Attachment #1: Type: text/plain, Size: 525 bytes --]
On Wed, 2004-07-28 at 15:01, Jesse Barnes wrote:
> On Wednesday, July 28, 2004 1:55 pm, Dave Hansen wrote:
> > Compile tested on SMP x86 and NUMAQ. I plan to give it a run on ppc64
> > in a bit. I'd appreciate if one of the ia64 guys could make sure it's
> > OK for them as well.
>
> Which tree is this against? It doesn't apply to the bk tree or
> linux-2.6.8-rc2-mm1.
Put this one before it, and it should apply cleanly. I posted this one
earlier today, and didn't realize that the new one was dependent.
-- Dave
[-- Attachment #2: A-zoneinit_cleanup.patch --]
[-- Type: text/x-patch, Size: 4760 bytes --]
Only in A-zoneinit_cleanup/arch/i386/kernel: .semaphore.o.cmd
Only in A-zoneinit_cleanup/arch/i386/kernel: semaphore.o
Only in ../linux-2.6.8-rc2-mm1/arch/i386/mm: .init.o.d
Only in ../linux-2.6.8-rc2-mm1/arch/i386/mm: .init.o.tmp
diff -ur ../linux-2.6.8-rc2-mm1/include/linux/compile.h A-zoneinit_cleanup/include/linux/compile.h
--- ../linux-2.6.8-rc2-mm1/include/linux/compile.h 2004-07-28 13:15:16.000000000 -0700
+++ A-zoneinit_cleanup/include/linux/compile.h 2004-07-28 13:14:34.000000000 -0700
@@ -1,7 +1,7 @@
/* This file is auto generated, version 0 */
#define UTS_MACHINE "i386"
-#define UTS_VERSION "#0 SMP Wed Jul 28 13:15:16 PDT 2004"
-#define LINUX_COMPILE_TIME "13:15:16"
+#define UTS_VERSION "#0 SMP Wed Jul 28 13:14:33 PDT 2004"
+#define LINUX_COMPILE_TIME "13:14:33"
#define LINUX_COMPILE_BY "root"
#define LINUX_COMPILE_HOST "elm3b82"
#define LINUX_COMPILE_DOMAIN "eng.beaverton.ibm.com"
Only in ../linux-2.6.8-rc2-mm1/init: .do_mounts.o.cmd
Only in ../linux-2.6.8-rc2-mm1/init: .initramfs.o.d
Only in ../linux-2.6.8-rc2-mm1/init: .version.o.cmd
Only in ../linux-2.6.8-rc2-mm1/init: do_mounts.o
Only in ../linux-2.6.8-rc2-mm1/init: version.o
diff -ur ../linux-2.6.8-rc2-mm1/mm/page_alloc.c A-zoneinit_cleanup/mm/page_alloc.c
--- ../linux-2.6.8-rc2-mm1/mm/page_alloc.c 2004-07-28 11:31:08.000000000 -0700
+++ A-zoneinit_cleanup/mm/page_alloc.c 2004-07-28 11:32:38.000000000 -0700
@@ -1415,6 +1415,52 @@
}
}
+/*
+ * Page buddy system uses "index >> (i+1)", where "index" is
+ * at most "size-1".
+ *
+ * The extra "+3" is to round down to byte size (8 bits per byte
+ * assumption). Thus we get "(size-1) >> (i+4)" as the last byte
+ * we can access.
+ *
+ * The "+1" is because we want to round the byte allocation up
+ * rather than down. So we should have had a "+7" before we shifted
+ * down by three. Also, we have to add one as we actually _use_ the
+ * last bit (it's [0,n] inclusive, not [0,n[).
+ *
+ * So we actually had +7+1 before we shift down by 3. But
+ * (n+8) >> 3 == (n >> 3) + 1 (modulo overflows, which we do not have).
+ *
+ * Finally, we LONG_ALIGN because all bitmap operations are on longs.
+ */
+unsigned long pages_to_bitmap_size(unsigned long order, unsigned long nr_pages)
+{
+ unsigned long bitmap_size;
+
+ bitmap_size = (nr_pages-1) >> (order+4);
+ bitmap_size = LONG_ALIGN(bitmap_size+1);
+
+ return bitmap_size;
+}
+
+void zone_init_free_lists(struct pglist_data *pgdat, struct zone *zone, unsigned long size)
+{
+ int order;
+ for (order = 0; ; order++) {
+ unsigned long bitmap_size;
+
+ INIT_LIST_HEAD(&zone->free_area[order].free_list);
+ if (order == MAX_ORDER-1) {
+ zone->free_area[order].map = NULL;
+ break;
+ }
+
+ bitmap_size = pages_to_bitmap_size(order, size);
+ zone->free_area[order].map =
+ (unsigned long *) alloc_bootmem_node(pgdat, bitmap_size);
+ }
+}
+
#ifndef __HAVE_ARCH_MEMMAP_INIT
#define memmap_init(start, size, nid, zone, start_pfn) \
memmap_init_zone((start), (size), (nid), (zone), (start_pfn))
@@ -1531,43 +1577,7 @@
zone_start_pfn += size;
lmem_map += size;
- for (i = 0; ; i++) {
- unsigned long bitmap_size;
-
- INIT_LIST_HEAD(&zone->free_area[i].free_list);
- if (i == MAX_ORDER-1) {
- zone->free_area[i].map = NULL;
- break;
- }
-
- /*
- * Page buddy system uses "index >> (i+1)",
- * where "index" is at most "size-1".
- *
- * The extra "+3" is to round down to byte
- * size (8 bits per byte assumption). Thus
- * we get "(size-1) >> (i+4)" as the last byte
- * we can access.
- *
- * The "+1" is because we want to round the
- * byte allocation up rather than down. So
- * we should have had a "+7" before we shifted
- * down by three. Also, we have to add one as
- * we actually _use_ the last bit (it's [0,n]
- * inclusive, not [0,n[).
- *
- * So we actually had +7+1 before we shift
- * down by 3. But (n+8) >> 3 == (n >> 3) + 1
- * (modulo overflows, which we do not have).
- *
- * Finally, we LONG_ALIGN because all bitmap
- * operations are on longs.
- */
- bitmap_size = (size-1) >> (i+4);
- bitmap_size = LONG_ALIGN(bitmap_size+1);
- zone->free_area[i].map =
- (unsigned long *) alloc_bootmem_node(pgdat, bitmap_size);
- }
+ zone_init_free_lists(pgdat, zone, zone->spanned_pages);
}
}
Binary files ../linux-2.6.8-rc2-mm1/usr/built-in.o and A-zoneinit_cleanup/usr/built-in.o differ
Binary files ../linux-2.6.8-rc2-mm1/usr/initramfs_data.cpio and A-zoneinit_cleanup/usr/initramfs_data.cpio differ
Binary files ../linux-2.6.8-rc2-mm1/usr/initramfs_data.cpio.gz and A-zoneinit_cleanup/usr/initramfs_data.cpio.gz differ
Binary files ../linux-2.6.8-rc2-mm1/usr/initramfs_data.o and A-zoneinit_cleanup/usr/initramfs_data.o differ
^ permalink raw reply [flat|nested] 15+ messages in thread* Re: [PATCH] don't pass mem_map into init functions
2004-07-28 22:19 ` Dave Hansen
@ 2004-07-28 22:39 ` Jesse Barnes
2004-07-28 23:18 ` Dave Hansen
0 siblings, 1 reply; 15+ messages in thread
From: Jesse Barnes @ 2004-07-28 22:39 UTC (permalink / raw)
To: Dave Hansen
Cc: Martin J. Bligh, linux-mm, LSE, Anton Blanchard,
Linux Kernel Mailing List, davidm, tony.luck
[-- Attachment #1: Type: text/plain, Size: 672 bytes --]
On Wednesday, July 28, 2004 3:19 pm, Dave Hansen wrote:
> On Wed, 2004-07-28 at 15:01, Jesse Barnes wrote:
> > On Wednesday, July 28, 2004 1:55 pm, Dave Hansen wrote:
> > > Compile tested on SMP x86 and NUMAQ. I plan to give it a run on ppc64
> > > in a bit. I'd appreciate if one of the ia64 guys could make sure it's
> > > OK for them as well.
> >
> > Which tree is this against? It doesn't apply to the bk tree or
> > linux-2.6.8-rc2-mm1.
>
> Put this one before it, and it should apply cleanly. I posted this one
> earlier today, and didn't realize that the new one was dependent.
You're missing this little bit from your patchset. Cc'ing Tony and David.
Jesse
[-- Attachment #2: memmap-cleanup-fix.patch --]
[-- Type: text/plain, Size: 1582 bytes --]
diff -Napur -X /home/jbarnes/dontdiff linux-2.5-memmap.orig/arch/ia64/mm/init.c linux-2.5-memmap/arch/ia64/mm/init.c
--- linux-2.5-memmap.orig/arch/ia64/mm/init.c 2004-07-28 15:42:32.000000000 -0700
+++ linux-2.5-memmap/arch/ia64/mm/init.c 2004-07-28 15:38:19.000000000 -0700
@@ -433,14 +433,17 @@ virtual_memmap_init (u64 start, u64 end,
}
void
-memmap_init (struct page *start, unsigned long size, int nid,
- unsigned long zone, unsigned long start_pfn)
+memmap_init (unsigned long size, int nid, unsigned long zone,
+ unsigned long start_pfn)
{
if (!vmem_map)
memmap_init_zone(size, nid, zone, start_pfn);
else {
+ struct page *start;
struct memmap_init_callback_data args;
+ start = pfn_to_page(start_pfn);
+
args.start = start;
args.end = start + size;
args.nid = nid;
diff -Napur -X /home/jbarnes/dontdiff linux-2.5-memmap.orig/include/asm-ia64/pgtable.h linux-2.5-memmap/include/asm-ia64/pgtable.h
--- linux-2.5-memmap.orig/include/asm-ia64/pgtable.h 2004-07-28 15:42:04.000000000 -0700
+++ linux-2.5-memmap/include/asm-ia64/pgtable.h 2004-07-28 15:38:45.000000000 -0700
@@ -515,7 +515,7 @@ do { \
# ifdef CONFIG_VIRTUAL_MEM_MAP
/* arch mem_map init routine is needed due to holes in a virtual mem_map */
# define __HAVE_ARCH_MEMMAP_INIT
- extern void memmap_init (struct page *start, unsigned long size, int nid, unsigned long zone,
+ extern void memmap_init (unsigned long size, int nid, unsigned long zone,
unsigned long start_pfn);
# endif /* CONFIG_VIRTUAL_MEM_MAP */
# endif /* !__ASSEMBLY__ */
^ permalink raw reply [flat|nested] 15+ messages in thread* Re: [PATCH] don't pass mem_map into init functions
2004-07-28 22:39 ` Jesse Barnes
@ 2004-07-28 23:18 ` Dave Hansen
2004-07-29 1:33 ` Jesse Barnes
2004-07-29 23:10 ` Dave Hansen
0 siblings, 2 replies; 15+ messages in thread
From: Dave Hansen @ 2004-07-28 23:18 UTC (permalink / raw)
To: Jesse Barnes
Cc: Martin J. Bligh, linux-mm, LSE, Anton Blanchard,
Linux Kernel Mailing List, davidm, tony.luck
On Wed, 2004-07-28 at 15:39, Jesse Barnes wrote:
> You're missing this little bit from your patchset. Cc'ing Tony and David.
Thanks for finding that. That appears to be an ia64-ism, so I think the
rest of the patch is OK.
-- Dave
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH] don't pass mem_map into init functions
2004-07-28 23:18 ` Dave Hansen
@ 2004-07-29 1:33 ` Jesse Barnes
2004-07-29 23:10 ` Dave Hansen
1 sibling, 0 replies; 15+ messages in thread
From: Jesse Barnes @ 2004-07-29 1:33 UTC (permalink / raw)
To: Dave Hansen
Cc: Martin J. Bligh, linux-mm, LSE, Anton Blanchard,
Linux Kernel Mailing List, davidm, tony.luck
On Wednesday, July 28, 2004 4:18 pm, Dave Hansen wrote:
> On Wed, 2004-07-28 at 15:39, Jesse Barnes wrote:
> > You're missing this little bit from your patchset. Cc'ing Tony and
> > David.
>
> Thanks for finding that. That appears to be an ia64-ism, so I think the
> rest of the patch is OK.
Well, it booted anyway :). I didn't check to see if any other arches had
their own memmap_init routines though, I'm assuming you already covered
those.
Jesse
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH] don't pass mem_map into init functions
2004-07-28 23:18 ` Dave Hansen
2004-07-29 1:33 ` Jesse Barnes
@ 2004-07-29 23:10 ` Dave Hansen
2004-07-30 14:29 ` Martin J. Bligh
1 sibling, 1 reply; 15+ messages in thread
From: Dave Hansen @ 2004-07-29 23:10 UTC (permalink / raw)
To: Martin J. Bligh
Cc: linux-mm, LSE, Anton Blanchard, Linux Kernel Mailing List, davidm,
tony.luck, Jesse Barnes
Martin,
I think that zone init code is yours from the initial CONFIG_NUMA port
and the kva remap code. Do you think it's ready to go upstream? If so,
do you want to send it, or should I?
It works on the NUMAQ, on regular SMP and Jesse Barnes tested it too.
-- Dave
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH] don't pass mem_map into init functions
2004-07-29 23:10 ` Dave Hansen
@ 2004-07-30 14:29 ` Martin J. Bligh
0 siblings, 0 replies; 15+ messages in thread
From: Martin J. Bligh @ 2004-07-30 14:29 UTC (permalink / raw)
To: Dave Hansen
Cc: linux-mm, LSE, Anton Blanchard, Linux Kernel Mailing List, davidm,
tony.luck, Jesse Barnes
> I think that zone init code is yours from the initial CONFIG_NUMA port
> and the kva remap code. Do you think it's ready to go upstream? If so,
> do you want to send it, or should I?
>
> It works on the NUMAQ, on regular SMP and Jesse Barnes tested it too.
Which bit of the zone_init code are we talking about? the re-ordering you
did? If so, that looked OK, but I'd like to test it on the x440 as well,
I'll power that up this morning and test it.
M.
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH] don't pass mem_map into init functions
@ 2004-08-04 1:01 Dave Hansen
2004-08-04 18:48 ` Jesse Barnes
` (2 more replies)
0 siblings, 3 replies; 15+ messages in thread
From: Dave Hansen @ 2004-08-04 1:01 UTC (permalink / raw)
To: Andrew Morton; +Cc: Linux Kernel Mailing List, Jesse Barnes
[-- Attachment #1: Type: text/plain, Size: 1265 bytes --]
When using CONFIG_NONLINEAR, a zone's mem_map isn't contiguous, and
isn't allocated in the same place. This means that nonlinear doesn't
really have a mem_map[] to pass into free_area_init_node() or
memmap_init_zone() which makes any sense.
So, this patch removes the 'struct page *mem_map' argument to both of
those functions. All non-NUMA architectures just pass a NULL in there,
which is ignored. The solution on the NUMA arches is to pass the
mem_map in via the pgdat, which works just fine.
To replace the removed arguments, a call to pfn_to_page(node_start_pfn)
is made. This is valid because all of the pfn_to_page() implementations
rely only on the pgdats, which are already set up at this time. Plus,
the pfn_to_page() method should work for any future nonlinear-type
code.
Finally, the patch creates a function: node_alloc_mem_map(), which I
plan to effectively #ifdef out for nonlinear at some future date.
Compile tested and booted on SMP x86, NUMAQ, and ppc64. Jesse Barnes
said he gave it a run on an ia64 box, and needed one additional patch:
http://marc.theaimsgroup.com/?l=linux-kernel&m=109105562606682&q=raw
Jesse, could you follow up to this mail with a copy of your patch?
Attached patch is against 2.6.8-rc2-mm2.
-- Dave
[-- Attachment #2: B-init-no-mem_map.patch --]
[-- Type: text/x-patch, Size: 8358 bytes --]
---
memhotplug-dave/arch/alpha/mm/numa.c | 2 -
memhotplug-dave/arch/ia64/mm/contig.c | 3 +-
memhotplug-dave/arch/ia64/mm/init.c | 2 -
memhotplug-dave/arch/ppc64/mm/init.c | 2 -
memhotplug-dave/arch/sh/mm/init.c | 2 -
memhotplug-dave/include/linux/mm.h | 5 +---
memhotplug-dave/mm/page_alloc.c | 37 ++++++++++++++++++----------------
7 files changed, 28 insertions(+), 25 deletions(-)
diff -puN arch/alpha/mm/numa.c~B-init-no-mem_map arch/alpha/mm/numa.c
--- memhotplug/arch/alpha/mm/numa.c~B-init-no-mem_map Tue Aug 3 17:45:34 2004
+++ memhotplug-dave/arch/alpha/mm/numa.c Tue Aug 3 17:45:34 2004
@@ -313,7 +313,7 @@ void __init paging_init(void)
zones_size[ZONE_DMA] = dma_local_pfn;
zones_size[ZONE_NORMAL] = (end_pfn - start_pfn) - dma_local_pfn;
}
- free_area_init_node(nid, NODE_DATA(nid), NULL, zones_size, start_pfn, NULL);
+ free_area_init_node(nid, NODE_DATA(nid), zones_size, start_pfn, NULL);
}
/* Initialize the kernel's ZERO_PGE. */
diff -puN arch/arm/mm/init.c~B-init-no-mem_map arch/arm/mm/init.c
diff -puN arch/arm26/mm/init.c~B-init-no-mem_map arch/arm26/mm/init.c
diff -puN arch/cris/arch-v10/mm/init.c~B-init-no-mem_map arch/cris/arch-v10/mm/init.c
diff -puN arch/i386/mm/discontig.c~B-init-no-mem_map arch/i386/mm/discontig.c
diff -puN arch/ia64/mm/contig.c~B-init-no-mem_map arch/ia64/mm/contig.c
--- memhotplug/arch/ia64/mm/contig.c~B-init-no-mem_map Tue Aug 3 17:45:34 2004
+++ memhotplug-dave/arch/ia64/mm/contig.c Tue Aug 3 17:45:34 2004
@@ -280,7 +280,8 @@ paging_init (void)
vmem_map = (struct page *) vmalloc_end;
efi_memmap_walk(create_mem_map_page_table, 0);
- free_area_init_node(0, &contig_page_data, vmem_map, zones_size,
+ contig_page_data.node_mem_map = vmem_map;
+ free_area_init_node(0, &contig_page_data, zones_size,
0, zholes_size);
mem_map = contig_page_data.node_mem_map;
diff -puN arch/ia64/mm/discontig.c~B-init-no-mem_map arch/ia64/mm/discontig.c
diff -puN arch/ia64/mm/init.c~B-init-no-mem_map arch/ia64/mm/init.c
--- memhotplug/arch/ia64/mm/init.c~B-init-no-mem_map Tue Aug 3 17:45:34 2004
+++ memhotplug-dave/arch/ia64/mm/init.c Tue Aug 3 17:45:34 2004
@@ -437,7 +437,7 @@ memmap_init (struct page *start, unsigne
unsigned long zone, unsigned long start_pfn)
{
if (!vmem_map)
- memmap_init_zone(start, size, nid, zone, start_pfn);
+ memmap_init_zone(size, nid, zone, start_pfn);
else {
struct memmap_init_callback_data args;
diff -puN arch/mips/sgi-ip27/ip27-memory.c~B-init-no-mem_map arch/mips/sgi-ip27/ip27-memory.c
diff -puN arch/parisc/mm/init.c~B-init-no-mem_map arch/parisc/mm/init.c
diff -puN arch/ppc64/mm/init.c~B-init-no-mem_map arch/ppc64/mm/init.c
--- memhotplug/arch/ppc64/mm/init.c~B-init-no-mem_map Tue Aug 3 17:45:34 2004
+++ memhotplug-dave/arch/ppc64/mm/init.c Tue Aug 3 17:45:34 2004
@@ -587,7 +587,7 @@ void __init paging_init(void)
zones_size[ZONE_DMA] = top_of_ram >> PAGE_SHIFT;
zholes_size[ZONE_DMA] = (top_of_ram - total_ram) >> PAGE_SHIFT;
- free_area_init_node(0, &contig_page_data, NULL, zones_size,
+ 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;
}
diff -puN arch/ppc64/mm/numa.c~B-init-no-mem_map arch/ppc64/mm/numa.c
diff -puN arch/sh/mm/init.c~B-init-no-mem_map arch/sh/mm/init.c
--- memhotplug/arch/sh/mm/init.c~B-init-no-mem_map Tue Aug 3 17:45:34 2004
+++ memhotplug-dave/arch/sh/mm/init.c Tue Aug 3 17:45:34 2004
@@ -225,7 +225,7 @@ void __init paging_init(void)
*/
zones_size[ZONE_DMA] = __MEMORY_SIZE_2ND >> PAGE_SHIFT;
zones_size[ZONE_NORMAL] = 0;
- free_area_init_node(1, NODE_DATA(1), 0, zones_size, __MEMORY_START_2ND >> PAGE_SHIFT, 0);
+ free_area_init_node(1, NODE_DATA(1), zones_size, __MEMORY_START_2ND >> PAGE_SHIFT, 0);
#endif
}
diff -puN arch/sh64/mm/init.c~B-init-no-mem_map arch/sh64/mm/init.c
diff -puN arch/sparc/mm/srmmu.c~B-init-no-mem_map arch/sparc/mm/srmmu.c
diff -puN arch/sparc/mm/sun4c.c~B-init-no-mem_map arch/sparc/mm/sun4c.c
diff -puN arch/sparc64/mm/init.c~B-init-no-mem_map arch/sparc64/mm/init.c
diff -puN arch/x86_64/mm/numa.c~B-init-no-mem_map arch/x86_64/mm/numa.c
diff -puN include/linux/mm.h~B-init-no-mem_map include/linux/mm.h
--- memhotplug/include/linux/mm.h~B-init-no-mem_map Tue Aug 3 17:45:34 2004
+++ memhotplug-dave/include/linux/mm.h Tue Aug 3 17:45:34 2004
@@ -590,11 +590,10 @@ static inline pmd_t *pmd_alloc(struct mm
}
extern void free_area_init(unsigned long * zones_size);
-extern void free_area_init_node(int nid, pg_data_t *pgdat, struct page *pmap,
+extern void free_area_init_node(int nid, pg_data_t *pgdat,
unsigned long * zones_size, unsigned long zone_start_pfn,
unsigned long *zholes_size);
-extern void memmap_init_zone(struct page *, unsigned long, int,
- unsigned long, unsigned long);
+extern void memmap_init_zone(unsigned long, int, unsigned long, unsigned long);
extern void mem_init(void);
extern void show_mem(void);
extern void si_meminfo(struct sysinfo * val);
diff -puN mm/page_alloc.c~B-init-no-mem_map mm/page_alloc.c
--- memhotplug/mm/page_alloc.c~B-init-no-mem_map Tue Aug 3 17:45:34 2004
+++ memhotplug-dave/mm/page_alloc.c Tue Aug 3 17:45:34 2004
@@ -1385,9 +1385,10 @@ static void __init calculate_zone_totalp
* up by free_all_bootmem() once the early boot process is
* done. Non-atomic initialization, single-pass.
*/
-void __init memmap_init_zone(struct page *start, unsigned long size, int nid,
- unsigned long zone, unsigned long start_pfn)
+void __init memmap_init_zone(unsigned long size, int nid, unsigned long zone,
+ unsigned long start_pfn)
{
+ struct page *start = pfn_to_page(start_pfn);
struct page *page;
for (page = start; page < (start + size); page++) {
@@ -1451,8 +1452,8 @@ void zone_init_free_lists(struct pglist_
}
#ifndef __HAVE_ARCH_MEMMAP_INIT
-#define memmap_init(start, size, nid, zone, start_pfn) \
- memmap_init_zone((start), (size), (nid), (zone), (start_pfn))
+#define memmap_init(size, nid, zone, start_pfn) \
+ memmap_init_zone((size), (nid), (zone), (start_pfn))
#endif
/*
@@ -1467,7 +1468,6 @@ static void __init free_area_init_core(s
unsigned long i, j;
const unsigned long zone_required_alignment = 1UL << (MAX_ORDER-1);
int cpu, nid = pgdat->node_id;
- struct page *lmem_map = pgdat->node_mem_map;
unsigned long zone_start_pfn = pgdat->node_start_pfn;
pgdat->nr_zones = 0;
@@ -1555,35 +1555,38 @@ static void __init free_area_init_core(s
pgdat->nr_zones = j+1;
- zone->zone_mem_map = lmem_map;
+ zone->zone_mem_map = pfn_to_page(zone_start_pfn);
zone->zone_start_pfn = zone_start_pfn;
if ((zone_start_pfn) & (zone_required_alignment-1))
printk("BUG: wrong zone alignment, it will crash\n");
- memmap_init(lmem_map, size, nid, j, zone_start_pfn);
+ memmap_init(size, nid, j, zone_start_pfn);
zone_start_pfn += size;
- lmem_map += size;
zone_init_free_lists(pgdat, zone, zone->spanned_pages);
}
}
-void __init free_area_init_node(int nid, struct pglist_data *pgdat,
- struct page *node_mem_map, unsigned long *zones_size,
- unsigned long node_start_pfn, unsigned long *zholes_size)
+void __init node_alloc_mem_map(struct pglist_data *pgdat)
{
unsigned long size;
+ size = (pgdat->node_spanned_pages + 1) * sizeof(struct page);
+ pgdat->node_mem_map = alloc_bootmem_node(pgdat, size);
+}
+
+void __init free_area_init_node(int nid, struct pglist_data *pgdat,
+ unsigned long *zones_size, unsigned long node_start_pfn,
+ unsigned long *zholes_size)
+{
pgdat->node_id = nid;
pgdat->node_start_pfn = node_start_pfn;
calculate_zone_totalpages(pgdat, zones_size, zholes_size);
- if (!node_mem_map) {
- size = (pgdat->node_spanned_pages + 1) * sizeof(struct page);
- node_mem_map = alloc_bootmem_node(pgdat, size);
- }
- pgdat->node_mem_map = node_mem_map;
+
+ if (!pfn_to_page(node_start_pfn))
+ node_alloc_mem_map(pgdat);
free_area_init_core(pgdat, zones_size, zholes_size);
}
@@ -1596,7 +1599,7 @@ EXPORT_SYMBOL(contig_page_data);
void __init free_area_init(unsigned long *zones_size)
{
- free_area_init_node(0, &contig_page_data, NULL, zones_size,
+ free_area_init_node(0, &contig_page_data, zones_size,
__pa(PAGE_OFFSET) >> PAGE_SHIFT, NULL);
mem_map = contig_page_data.node_mem_map;
}
_
^ permalink raw reply [flat|nested] 15+ messages in thread* Re: [PATCH] don't pass mem_map into init functions
2004-08-04 1:01 Dave Hansen
@ 2004-08-04 18:48 ` Jesse Barnes
2004-08-05 4:42 ` Andrew Morton
2004-08-05 21:13 ` Andrew Morton
2 siblings, 0 replies; 15+ messages in thread
From: Jesse Barnes @ 2004-08-04 18:48 UTC (permalink / raw)
To: Dave Hansen; +Cc: Andrew Morton, Linux Kernel Mailing List
[-- Attachment #1: Type: text/plain, Size: 312 bytes --]
On Tuesday, August 3, 2004 6:01 pm, Dave Hansen wrote:
> Jesse, could you follow up to this mail with a copy of your patch?
>
> Attached patch is against 2.6.8-rc2-mm2.
Fix up ia64 specific memory map init function in light of Dave's memmap_init
cleanups.
Signed-off-by: Jesse Barnes <jbarnes@sgi.com>
Jesse
[-- Attachment #2: memmap-cleanup-fix-2.patch --]
[-- Type: text/plain, Size: 1611 bytes --]
diff -Napur -X /home/jbarnes/dontdiff linux-2.6.8-rc2-mm2.orig/arch/ia64/mm/init.c linux-2.6.8-rc2-mm2/arch/ia64/mm/init.c
--- linux-2.6.8-rc2-mm2.orig/arch/ia64/mm/init.c 2004-08-04 11:45:06.000000000 -0700
+++ linux-2.6.8-rc2-mm2/arch/ia64/mm/init.c 2004-08-04 11:47:29.000000000 -0700
@@ -433,14 +433,16 @@ virtual_memmap_init (u64 start, u64 end,
}
void
-memmap_init (struct page *start, unsigned long size, int nid,
- unsigned long zone, unsigned long start_pfn)
+memmap_init (unsigned long size, int nid, unsigned long zone,
+ unsigned long start_pfn)
{
if (!vmem_map)
memmap_init_zone(start, size, nid, zone, start_pfn);
else {
+ struct page *start;
struct memmap_init_callback_data args;
+ start = pfn_to_page(start_pfn);
args.start = start;
args.end = start + size;
args.nid = nid;
diff -Napur -X /home/jbarnes/dontdiff linux-2.6.8-rc2-mm2.orig/include/asm-ia64/pgtable.h linux-2.6.8-rc2-mm2/include/asm-ia64/pgtable.h
--- linux-2.6.8-rc2-mm2.orig/include/asm-ia64/pgtable.h 2004-08-04 11:45:08.000000000 -0700
+++ linux-2.6.8-rc2-mm2/include/asm-ia64/pgtable.h 2004-08-04 11:45:40.000000000 -0700
@@ -520,7 +520,7 @@ do { \
# ifdef CONFIG_VIRTUAL_MEM_MAP
/* arch mem_map init routine is needed due to holes in a virtual mem_map */
# define __HAVE_ARCH_MEMMAP_INIT
- extern void memmap_init (struct page *start, unsigned long size, int nid, unsigned long zone,
+ extern void memmap_init (unsigned long size, int nid, unsigned long zone,
unsigned long start_pfn);
# endif /* CONFIG_VIRTUAL_MEM_MAP */
# endif /* !__ASSEMBLY__ */
^ permalink raw reply [flat|nested] 15+ messages in thread* Re: [PATCH] don't pass mem_map into init functions
2004-08-04 1:01 Dave Hansen
2004-08-04 18:48 ` Jesse Barnes
@ 2004-08-05 4:42 ` Andrew Morton
2004-08-05 18:55 ` Dave Hansen
2004-08-05 21:13 ` Andrew Morton
2 siblings, 1 reply; 15+ messages in thread
From: Andrew Morton @ 2004-08-05 4:42 UTC (permalink / raw)
To: Dave Hansen; +Cc: linux-kernel, jbarnes
Dave Hansen <haveblue@us.ibm.com> wrote:
>
> When using CONFIG_NONLINEAR, a zone's mem_map isn't contiguous, and
> isn't allocated in the same place. This means that nonlinear doesn't
> really have a mem_map[] to pass into free_area_init_node() or
> memmap_init_zone() which makes any sense.
>
> So, this patch removes the 'struct page *mem_map' argument to both of
> those functions. All non-NUMA architectures just pass a NULL in there,
> which is ignored. The solution on the NUMA arches is to pass the
> mem_map in via the pgdat, which works just fine.
>
> To replace the removed arguments, a call to pfn_to_page(node_start_pfn)
> is made. This is valid because all of the pfn_to_page() implementations
> rely only on the pgdats, which are already set up at this time. Plus,
> the pfn_to_page() method should work for any future nonlinear-type
> code.
>
> Finally, the patch creates a function: node_alloc_mem_map(), which I
> plan to effectively #ifdef out for nonlinear at some future date.
You wanna take a shot at fixing this up please?
arch/sparc64/mm/init.c: In function `paging_init':
arch/sparc64/mm/init.c:1589: warning: passing arg 4 of `free_area_init_node' makes integer from pointer without a cast
arch/sparc64/mm/init.c:1589: warning: passing arg 5 of `free_area_init_node' makes pointer from integer without a cast
arch/sparc64/mm/init.c:1589: error: too many arguments to function `free_area_init_node'
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH] don't pass mem_map into init functions
2004-08-05 4:42 ` Andrew Morton
@ 2004-08-05 18:55 ` Dave Hansen
0 siblings, 0 replies; 15+ messages in thread
From: Dave Hansen @ 2004-08-05 18:55 UTC (permalink / raw)
To: Andrew Morton; +Cc: Linux Kernel Mailing List, Jesse Barnes
[-- Attachment #1: Type: text/plain, Size: 624 bytes --]
On Wed, 2004-08-04 at 21:42, Andrew Morton wrote:
> You wanna take a shot at fixing this up please?
>
> arch/sparc64/mm/init.c: In function `paging_init':
> arch/sparc64/mm/init.c:1589: warning: passing arg 4 of `free_area_init_node' makes integer from pointer without a cast
> arch/sparc64/mm/init.c:1589: warning: passing arg 5 of `free_area_init_node' makes pointer from integer without a cast
> arch/sparc64/mm/init.c:1589: error: too many arguments to function `free_area_init_node'
Looks like I missed a couple of architectures. This patch, on top of my
previous one and Jesse's should clean up the rest.
-- Dave
[-- Attachment #2: B2-init-no-mem_map-morearches.patch --]
[-- Type: text/x-patch, Size: 5132 bytes --]
---
memhotplug-dave/arch/arm/mm/init.c | 2 +-
memhotplug-dave/arch/ia64/mm/contig.c | 2 +-
memhotplug-dave/arch/mips/sgi-ip27/ip27-memory.c | 2 +-
memhotplug-dave/arch/parisc/mm/init.c | 2 +-
memhotplug-dave/arch/sparc/mm/srmmu.c | 2 +-
memhotplug-dave/arch/sparc/mm/sun4c.c | 2 +-
memhotplug-dave/arch/sparc64/mm/init.c | 2 +-
memhotplug-dave/arch/x86_64/mm/numa.c | 2 +-
8 files changed, 8 insertions(+), 8 deletions(-)
diff -puN arch/arm/mm/init.c~B2-init-no-mem_map-morearches arch/arm/mm/init.c
--- memhotplug/arch/arm/mm/init.c~B2-init-no-mem_map-morearches Thu Aug 5 09:41:06 2004
+++ memhotplug-dave/arch/arm/mm/init.c Thu Aug 5 09:41:06 2004
@@ -502,7 +502,7 @@ void __init paging_init(struct meminfo *
*/
arch_adjust_zones(node, zone_size, zhole_size);
- free_area_init_node(node, pgdat, NULL, zone_size,
+ free_area_init_node(node, pgdat, zone_size,
bdata->node_boot_start >> PAGE_SHIFT, zhole_size);
}
diff -puN arch/ia64/mm/contig.c~B2-init-no-mem_map-morearches arch/ia64/mm/contig.c
--- memhotplug/arch/ia64/mm/contig.c~B2-init-no-mem_map-morearches Thu Aug 5 09:41:06 2004
+++ memhotplug-dave/arch/ia64/mm/contig.c Thu Aug 5 09:41:06 2004
@@ -267,7 +267,7 @@ paging_init (void)
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, NULL, zones_size, 0,
+ free_area_init_node(0, &contig_page_data, zones_size, 0,
zholes_size);
mem_map = contig_page_data.node_mem_map;
} else {
diff -puN arch/mips/sgi-ip27/ip27-memory.c~B2-init-no-mem_map-morearches arch/mips/sgi-ip27/ip27-memory.c
--- memhotplug/arch/mips/sgi-ip27/ip27-memory.c~B2-init-no-mem_map-morearches Thu Aug 5 09:41:06 2004
+++ memhotplug-dave/arch/mips/sgi-ip27/ip27-memory.c Thu Aug 5 09:41:06 2004
@@ -225,7 +225,7 @@ void __init paging_init(void)
pfn_t end_pfn = node_getmaxclick(node) + 1;
zones_size[ZONE_DMA] = end_pfn - start_pfn;
- free_area_init_node(node, NODE_DATA(node), NULL,
+ free_area_init_node(node, NODE_DATA(node),
zones_size, start_pfn, NULL);
if (end_pfn > max_low_pfn)
diff -puN arch/parisc/mm/init.c~B2-init-no-mem_map-morearches arch/parisc/mm/init.c
--- memhotplug/arch/parisc/mm/init.c~B2-init-no-mem_map-morearches Thu Aug 5 09:41:06 2004
+++ memhotplug-dave/arch/parisc/mm/init.c Thu Aug 5 09:41:06 2004
@@ -761,7 +761,7 @@ void __init paging_init(void)
unsigned long zones_size[MAX_NR_ZONES] = { 0, 0, 0, };
zones_size[ZONE_DMA] = pmem_ranges[i].pages;
- free_area_init_node(i,NODE_DATA(i),NULL,zones_size,
+ free_area_init_node(i,NODE_DATA(i),zones_size,
(pmem_ranges[i].start_pfn << PAGE_SHIFT),0);
}
diff -puN arch/sparc/mm/srmmu.c~B2-init-no-mem_map-morearches arch/sparc/mm/srmmu.c
--- memhotplug/arch/sparc/mm/srmmu.c~B2-init-no-mem_map-morearches Thu Aug 5 09:41:06 2004
+++ memhotplug-dave/arch/sparc/mm/srmmu.c Thu Aug 5 09:41:06 2004
@@ -1341,7 +1341,7 @@ void __init srmmu_paging_init(void)
zones_size[ZONE_HIGHMEM] = npages;
zholes_size[ZONE_HIGHMEM] = npages - calc_highpages();
- free_area_init_node(0, &contig_page_data, NULL, zones_size,
+ 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~B2-init-no-mem_map-morearches arch/sparc/mm/sun4c.c
--- memhotplug/arch/sparc/mm/sun4c.c~B2-init-no-mem_map-morearches Thu Aug 5 09:41:06 2004
+++ memhotplug-dave/arch/sparc/mm/sun4c.c Thu Aug 5 09:41:06 2004
@@ -2114,7 +2114,7 @@ void __init sun4c_paging_init(void)
zones_size[ZONE_HIGHMEM] = npages;
zholes_size[ZONE_HIGHMEM] = npages - calc_highpages();
- free_area_init_node(0, &contig_page_data, NULL, zones_size,
+ 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/sparc64/mm/init.c~B2-init-no-mem_map-morearches arch/sparc64/mm/init.c
--- memhotplug/arch/sparc64/mm/init.c~B2-init-no-mem_map-morearches Thu Aug 5 09:41:06 2004
+++ memhotplug-dave/arch/sparc64/mm/init.c Thu Aug 5 09:41:06 2004
@@ -1585,7 +1585,7 @@ void __init paging_init(void)
zones_size[ZONE_DMA] = npages;
zholes_size[ZONE_DMA] = npages - pages_avail;
- free_area_init_node(0, &contig_page_data, NULL, zones_size,
+ free_area_init_node(0, &contig_page_data, zones_size,
phys_base >> PAGE_SHIFT, zholes_size);
mem_map = contig_page_data.node_mem_map;
}
diff -puN arch/x86_64/mm/numa.c~B2-init-no-mem_map-morearches arch/x86_64/mm/numa.c
--- memhotplug/arch/x86_64/mm/numa.c~B2-init-no-mem_map-morearches Thu Aug 5 09:41:06 2004
+++ memhotplug-dave/arch/x86_64/mm/numa.c Thu Aug 5 09:41:06 2004
@@ -136,7 +136,7 @@ void __init setup_node_zones(int nodeid)
zones[ZONE_NORMAL] = end_pfn - start_pfn;
}
- free_area_init_node(nodeid, NODE_DATA(nodeid), NULL, zones,
+ free_area_init_node(nodeid, NODE_DATA(nodeid), zones,
start_pfn, NULL);
}
_
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH] don't pass mem_map into init functions
2004-08-04 1:01 Dave Hansen
2004-08-04 18:48 ` Jesse Barnes
2004-08-05 4:42 ` Andrew Morton
@ 2004-08-05 21:13 ` Andrew Morton
2004-08-05 23:58 ` Dave Hansen
2 siblings, 1 reply; 15+ messages in thread
From: Andrew Morton @ 2004-08-05 21:13 UTC (permalink / raw)
To: Dave Hansen; +Cc: linux-kernel, jbarnes
Dave Hansen <haveblue@us.ibm.com> wrote:
>
> When using CONFIG_NONLINEAR, a zone's mem_map isn't contiguous, and
> isn't allocated in the same place. This means that nonlinear doesn't
> really have a mem_map[] to pass into free_area_init_node() or
> memmap_init_zone() which makes any sense.
argh, sorry. It's this patch which I dropped due to psychedelic screen
syndrome. The "break out zone free list initialization" patch is innocent, and
was included in rc3-mm1.
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH] don't pass mem_map into init functions
2004-08-05 21:13 ` Andrew Morton
@ 2004-08-05 23:58 ` Dave Hansen
0 siblings, 0 replies; 15+ messages in thread
From: Dave Hansen @ 2004-08-05 23:58 UTC (permalink / raw)
To: Andrew Morton; +Cc: Linux Kernel Mailing List, Jesse Barnes
[-- Attachment #1: Type: text/plain, Size: 1019 bytes --]
On Thu, 2004-08-05 at 14:13, Andrew Morton wrote:
> Dave Hansen <haveblue@us.ibm.com> wrote:
> >
> > When using CONFIG_NONLINEAR, a zone's mem_map isn't contiguous, and
> > isn't allocated in the same place. This means that nonlinear doesn't
> > really have a mem_map[] to pass into free_area_init_node() or
> > memmap_init_zone() which makes any sense.
>
> argh, sorry. It's this patch which I dropped due to psychedelic screen
> syndrome. The "break out zone free list initialization" patch is innocent, and
> was included in rc3-mm1.
OK, here's a replacement for the bad one. I could provide an
incremental instead if you prefer.
Turns out I was initializing the mem_map too late. Not only did
pfn_to_page() use the pgdats, but it also used mem_map. Not
surprisingly, mem_map == NULL did not make things happy.
My earlier testing didn't catch it because I was always using either
DISCONTIGMEM or NONLINEAR (even on plain SMP because I'm weird), both of
which skip the code that I screwed up.
-- Dave
[-- Attachment #2: B-init-no-mem_map.patch --]
[-- Type: text/x-patch, Size: 8460 bytes --]
Signed-off-by: Dave Hansen <haveblue@us.ibm.com>
---
memhotplug-dave/arch/alpha/mm/numa.c | 2 -
memhotplug-dave/arch/ia64/mm/contig.c | 3 +-
memhotplug-dave/arch/ia64/mm/init.c | 2 -
memhotplug-dave/arch/ppc64/mm/init.c | 2 -
memhotplug-dave/arch/sh/mm/init.c | 2 -
memhotplug-dave/include/linux/mm.h | 5 +---
memhotplug-dave/mm/page_alloc.c | 39 ++++++++++++++++++----------------
7 files changed, 29 insertions(+), 26 deletions(-)
diff -puN arch/alpha/mm/numa.c~B-init-no-mem_map arch/alpha/mm/numa.c
--- memhotplug/arch/alpha/mm/numa.c~B-init-no-mem_map Thu Aug 5 16:45:32 2004
+++ memhotplug-dave/arch/alpha/mm/numa.c Thu Aug 5 16:45:32 2004
@@ -313,7 +313,7 @@ void __init paging_init(void)
zones_size[ZONE_DMA] = dma_local_pfn;
zones_size[ZONE_NORMAL] = (end_pfn - start_pfn) - dma_local_pfn;
}
- free_area_init_node(nid, NODE_DATA(nid), NULL, zones_size, start_pfn, NULL);
+ free_area_init_node(nid, NODE_DATA(nid), zones_size, start_pfn, NULL);
}
/* Initialize the kernel's ZERO_PGE. */
diff -puN arch/arm/mm/init.c~B-init-no-mem_map arch/arm/mm/init.c
diff -puN arch/arm26/mm/init.c~B-init-no-mem_map arch/arm26/mm/init.c
diff -puN arch/cris/arch-v10/mm/init.c~B-init-no-mem_map arch/cris/arch-v10/mm/init.c
diff -puN arch/i386/mm/discontig.c~B-init-no-mem_map arch/i386/mm/discontig.c
diff -puN arch/ia64/mm/contig.c~B-init-no-mem_map arch/ia64/mm/contig.c
--- memhotplug/arch/ia64/mm/contig.c~B-init-no-mem_map Thu Aug 5 16:45:32 2004
+++ memhotplug-dave/arch/ia64/mm/contig.c Thu Aug 5 16:45:32 2004
@@ -280,7 +280,8 @@ paging_init (void)
vmem_map = (struct page *) vmalloc_end;
efi_memmap_walk(create_mem_map_page_table, 0);
- free_area_init_node(0, &contig_page_data, vmem_map, zones_size,
+ contig_page_data.node_mem_map = vmem_map;
+ free_area_init_node(0, &contig_page_data, zones_size,
0, zholes_size);
mem_map = contig_page_data.node_mem_map;
diff -puN arch/ia64/mm/discontig.c~B-init-no-mem_map arch/ia64/mm/discontig.c
diff -puN arch/ia64/mm/init.c~B-init-no-mem_map arch/ia64/mm/init.c
--- memhotplug/arch/ia64/mm/init.c~B-init-no-mem_map Thu Aug 5 16:45:32 2004
+++ memhotplug-dave/arch/ia64/mm/init.c Thu Aug 5 16:45:32 2004
@@ -437,7 +437,7 @@ memmap_init (struct page *start, unsigne
unsigned long zone, unsigned long start_pfn)
{
if (!vmem_map)
- memmap_init_zone(start, size, nid, zone, start_pfn);
+ memmap_init_zone(size, nid, zone, start_pfn);
else {
struct memmap_init_callback_data args;
diff -puN arch/mips/sgi-ip27/ip27-memory.c~B-init-no-mem_map arch/mips/sgi-ip27/ip27-memory.c
diff -puN arch/parisc/mm/init.c~B-init-no-mem_map arch/parisc/mm/init.c
diff -puN arch/ppc64/mm/init.c~B-init-no-mem_map arch/ppc64/mm/init.c
--- memhotplug/arch/ppc64/mm/init.c~B-init-no-mem_map Thu Aug 5 16:45:32 2004
+++ memhotplug-dave/arch/ppc64/mm/init.c Thu Aug 5 16:45:32 2004
@@ -587,7 +587,7 @@ void __init paging_init(void)
zones_size[ZONE_DMA] = top_of_ram >> PAGE_SHIFT;
zholes_size[ZONE_DMA] = (top_of_ram - total_ram) >> PAGE_SHIFT;
- free_area_init_node(0, &contig_page_data, NULL, zones_size,
+ 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;
}
diff -puN arch/ppc64/mm/numa.c~B-init-no-mem_map arch/ppc64/mm/numa.c
diff -puN arch/sh/mm/init.c~B-init-no-mem_map arch/sh/mm/init.c
--- memhotplug/arch/sh/mm/init.c~B-init-no-mem_map Thu Aug 5 16:45:32 2004
+++ memhotplug-dave/arch/sh/mm/init.c Thu Aug 5 16:45:32 2004
@@ -225,7 +225,7 @@ void __init paging_init(void)
*/
zones_size[ZONE_DMA] = __MEMORY_SIZE_2ND >> PAGE_SHIFT;
zones_size[ZONE_NORMAL] = 0;
- free_area_init_node(1, NODE_DATA(1), 0, zones_size, __MEMORY_START_2ND >> PAGE_SHIFT, 0);
+ free_area_init_node(1, NODE_DATA(1), zones_size, __MEMORY_START_2ND >> PAGE_SHIFT, 0);
#endif
}
diff -puN arch/sh64/mm/init.c~B-init-no-mem_map arch/sh64/mm/init.c
diff -puN arch/sparc/mm/srmmu.c~B-init-no-mem_map arch/sparc/mm/srmmu.c
diff -puN arch/sparc/mm/sun4c.c~B-init-no-mem_map arch/sparc/mm/sun4c.c
diff -puN arch/sparc64/mm/init.c~B-init-no-mem_map arch/sparc64/mm/init.c
diff -puN arch/x86_64/mm/numa.c~B-init-no-mem_map arch/x86_64/mm/numa.c
diff -puN include/linux/mm.h~B-init-no-mem_map include/linux/mm.h
--- memhotplug/include/linux/mm.h~B-init-no-mem_map Thu Aug 5 16:45:32 2004
+++ memhotplug-dave/include/linux/mm.h Thu Aug 5 16:45:32 2004
@@ -590,11 +590,10 @@ static inline pmd_t *pmd_alloc(struct mm
}
extern void free_area_init(unsigned long * zones_size);
-extern void free_area_init_node(int nid, pg_data_t *pgdat, struct page *pmap,
+extern void free_area_init_node(int nid, pg_data_t *pgdat,
unsigned long * zones_size, unsigned long zone_start_pfn,
unsigned long *zholes_size);
-extern void memmap_init_zone(struct page *, unsigned long, int,
- unsigned long, unsigned long);
+extern void memmap_init_zone(unsigned long, int, unsigned long, unsigned long);
extern void mem_init(void);
extern void show_mem(void);
extern void si_meminfo(struct sysinfo * val);
diff -puN mm/page_alloc.c~B-init-no-mem_map mm/page_alloc.c
--- memhotplug/mm/page_alloc.c~B-init-no-mem_map Thu Aug 5 16:45:32 2004
+++ memhotplug-dave/mm/page_alloc.c Thu Aug 5 16:46:28 2004
@@ -1385,9 +1385,10 @@ static void __init calculate_zone_totalp
* up by free_all_bootmem() once the early boot process is
* done. Non-atomic initialization, single-pass.
*/
-void __init memmap_init_zone(struct page *start, unsigned long size, int nid,
- unsigned long zone, unsigned long start_pfn)
+void __init memmap_init_zone(unsigned long size, int nid, unsigned long zone,
+ unsigned long start_pfn)
{
+ struct page *start = pfn_to_page(start_pfn);
struct page *page;
for (page = start; page < (start + size); page++) {
@@ -1451,8 +1452,8 @@ void zone_init_free_lists(struct pglist_
}
#ifndef __HAVE_ARCH_MEMMAP_INIT
-#define memmap_init(start, size, nid, zone, start_pfn) \
- memmap_init_zone((start), (size), (nid), (zone), (start_pfn))
+#define memmap_init(size, nid, zone, start_pfn) \
+ memmap_init_zone((size), (nid), (zone), (start_pfn))
#endif
/*
@@ -1467,7 +1468,6 @@ static void __init free_area_init_core(s
unsigned long i, j;
const unsigned long zone_required_alignment = 1UL << (MAX_ORDER-1);
int cpu, nid = pgdat->node_id;
- struct page *lmem_map = pgdat->node_mem_map;
unsigned long zone_start_pfn = pgdat->node_start_pfn;
pgdat->nr_zones = 0;
@@ -1555,35 +1555,39 @@ static void __init free_area_init_core(s
pgdat->nr_zones = j+1;
- zone->zone_mem_map = lmem_map;
+ zone->zone_mem_map = pfn_to_page(zone_start_pfn);
zone->zone_start_pfn = zone_start_pfn;
if ((zone_start_pfn) & (zone_required_alignment-1))
printk("BUG: wrong zone alignment, it will crash\n");
- memmap_init(lmem_map, size, nid, j, zone_start_pfn);
+ memmap_init(size, nid, j, zone_start_pfn);
zone_start_pfn += size;
- lmem_map += size;
zone_init_free_lists(pgdat, zone, zone->spanned_pages);
}
}
-void __init free_area_init_node(int nid, struct pglist_data *pgdat,
- struct page *node_mem_map, unsigned long *zones_size,
- unsigned long node_start_pfn, unsigned long *zholes_size)
+void __init node_alloc_mem_map(struct pglist_data *pgdat)
{
unsigned long size;
+ size = (pgdat->node_spanned_pages + 1) * sizeof(struct page);
+ pgdat->node_mem_map = alloc_bootmem_node(pgdat, size);
+ mem_map = contig_page_data.node_mem_map;
+}
+
+void __init free_area_init_node(int nid, struct pglist_data *pgdat,
+ unsigned long *zones_size, unsigned long node_start_pfn,
+ unsigned long *zholes_size)
+{
pgdat->node_id = nid;
pgdat->node_start_pfn = node_start_pfn;
calculate_zone_totalpages(pgdat, zones_size, zholes_size);
- if (!node_mem_map) {
- size = (pgdat->node_spanned_pages + 1) * sizeof(struct page);
- node_mem_map = alloc_bootmem_node(pgdat, size);
- }
- pgdat->node_mem_map = node_mem_map;
+
+ if (!pfn_to_page(node_start_pfn))
+ node_alloc_mem_map(pgdat);
free_area_init_core(pgdat, zones_size, zholes_size);
}
@@ -1596,9 +1600,8 @@ EXPORT_SYMBOL(contig_page_data);
void __init free_area_init(unsigned long *zones_size)
{
- free_area_init_node(0, &contig_page_data, NULL, zones_size,
+ free_area_init_node(0, &contig_page_data, zones_size,
__pa(PAGE_OFFSET) >> PAGE_SHIFT, NULL);
- mem_map = contig_page_data.node_mem_map;
}
#endif
_
^ permalink raw reply [flat|nested] 15+ messages in thread
end of thread, other threads:[~2004-08-05 23:58 UTC | newest]
Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-07-28 20:55 [PATCH] don't pass mem_map into init functions Dave Hansen
2004-07-28 21:58 ` Jesse Barnes
2004-07-28 22:01 ` Jesse Barnes
2004-07-28 22:19 ` Dave Hansen
2004-07-28 22:39 ` Jesse Barnes
2004-07-28 23:18 ` Dave Hansen
2004-07-29 1:33 ` Jesse Barnes
2004-07-29 23:10 ` Dave Hansen
2004-07-30 14:29 ` Martin J. Bligh
-- strict thread matches above, loose matches on Subject: below --
2004-08-04 1:01 Dave Hansen
2004-08-04 18:48 ` Jesse Barnes
2004-08-05 4:42 ` Andrew Morton
2004-08-05 18:55 ` Dave Hansen
2004-08-05 21:13 ` Andrew Morton
2004-08-05 23:58 ` Dave Hansen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox