Skip to contentSkip to conversation

Sizing zones and holes in an architecture independent manner V6

PATCH In review Mel Gorman 6 participants 33 messages May 8, 2006 – May 23, 2006

Subsystems (5)
lore
Share & tools
lore

Mel Gorman

author
#0 lore raw

cover Sizing zones and holes in an architecture independent manner V6

This is V6 of the patchset to size zones and memory holes in an architecture-independent manner. This is based against 2.6.17-rc3-mm1 and as there were no objections to these patches since V4. Please merge.

The reasons why I'd like to this merged include;

o Less architecture-specific code - particularly for x86 and ppc64
o More maintainable. Changes to zone layout need only be made in one place
o Zone-sizing and memory hole calculation is one less job that needs to be done for new architecture ports
o With the architecture-independent representation, zone-based anti-fragmentation needs a lot less architecture-specific code making it more portable between architectures. This will be important for future hugepage-availability work
o Nigel Cunningham has stated that that software suspend could potentially use the architecture-independent representation to discover what pages need to be saved during suspend

When testing on powerpc, I found compile errors that looked like this;

arch/powerpc/kernel/built-in.o(.init.text+0x7778): In function `vrsqrtefp':
: undefined reference to __udivdi3' arch/powerpc/kernel/built-in.o(.init.text+0x77c4): In function vrsqrtefp':
: undefined reference to `__udivdi3'
make: *** [.tmp_vmlinux1] Error 1

A workaround that is *very likely wrong* and blatantly stolen from arch/sh is at http://www.csn.ul.ie/~mel/udivdi3-powerpc-workaround.diff .

Changelog since V5
o Add a missing #include to mm/mem_init.c
o Drop the verbose debugging part of the set
o Report active range registration when loglevel is set for KERN_DEBUG

Changelog since V4
o Rebase to 2.6.17-rc3-mm1
o Calculate holes on x86 with SRAT correctly

Changelog since V3
o Rebase to 2.6.17-rc2
o Allow the active regions to be cleared. Needed by x86_64 when it decides the SRAT table is bad half way through the registering of active regions
o Fix for flatmem x86_64 machines booting

Changelog since V2
o Fix a bug where holes in lower zones get double counted
o Catch the case where a new range is registered that is within an range
o Catch the case where a zone boundary is within a hole
o Use the EFI map for registering ranges on x86_64+numa
o On IA64+NUMA, add the active ranges before rounding for granules
o On x86_64, remove e820_hole_size and e820_bootmem_free and use arch-independent equivalents
o On x86_64, remove the map walk in e820_end_of_ram()
o Rename memory_present_with_active_regions, name ambiguous
o Add absent_pages_in_range() for arches to call

Changelog since V1
o Correctly convert virtual and physical addresses to PFNs on ia64
o Correctly convert physical addresses to PFN on older ppc
o When add_active_range() is called with overlapping pfn ranges, merge them
o When a zone boundary occurs within a memory hole, account correctly
o Minor whitespace damage cleanup
o Debugging patch temporarily included

At a basic level, architectures define structures to record where active ranges of page frames are located. Once located, the code to calculate zone sizes and holes in each architecture is very similar. Some of this zone and hole sizing code is difficult to read for no good reason. This set of patches eliminates the similar-looking architecture-specific code.

The patches introduce a mechanism where architectures register where the active ranges of page frames are with add_active_range(). When all areas have been discovered, free_area_init_nodes() is called to initialise the pgdat and zones. The zone sizes and holes are then calculated in an architecture independent manner.

Patch 1 introduces the mechanism for registering and initialising PFN ranges Patch 2 changes ppc to use the mechanism - 128 arch-specific LOC removed Patch 3 changes x86 to use the mechanism - 142 arch-specific LOC removed Patch 4 changes x86_64 to use the mechanism - 94 arch-specific LOC removed Patch 5 changes ia64 to use the mechanism - 57 arch-specific LOC removed

At this point, there is a reduction of 421 architecture-specific lines of code and a net reduction of 25 lines. The arch-independent code is a lot easier to read in comparison to some of the arch-specific stuff, particularly in arch/i386/ .

For Patch 6, it was also noted that page_alloc.c has a *lot* of initialisation code which makes the file harder to read than it needs to be. Patch 6 creates a new file mem_init.c and moves a lot of initialisation code from page_alloc.c to it. After the patch is applied, there is still a net loss of 7 lines.

The patches have been successfully boot tested by me and verified that the zones are the correct size on

o x86, flatmem with 1.5GiB of RAM
o x86, NUMAQ
o x86, NUMA, with SRAT
o x86 with SRAT CONFIG_NUMA=n
o PPC64, NUMA
o PPC64, CONFIG_NUMA=n
o PPC64, CONFIG_64BIT=N
o Power, RS6000 (Had difficulty here with missing __udivdi3 symbol)
o x86_64, NUMA with SRAT
o x86_64, NUMA with broken SRAT that falls back to k8topology discovery
o x86_64, ACPI_NUMA, ACPI_MEMORY_HOTPLUG && !SPARSEMEM to trigger the hotadd path without sparsemem fun in srat.c (SRAT broken on test machine and I'm pretty sure the machine does not support physical memory hotadd anyway so test may not have been effective other than being a compile test.)
o x86_64, CONFIG_NUMA=n
o x86_64, CONFIG_64=n
o x86_64, CONFIG_64=n, CONFIG_NUMA=n
o x86_64, AMD64 desktop machine with flatmem
o ia64 (Itanium 2)
o ia64 (Itanium 2), CONFIG_64=N

Tony Luck has successfully tested for ia64 on Itanium with tiger_defconfig, gensparse_defconfig and defconfig. Bob Picco has also tested and debugged on IA64. Jack Steiner successfully boot tested on a mammoth SGI IA64-based machine. These were on patches against 2.6.17-rc1 and release 3 of these patches but there have been no ia64-changes since release 3.

There are differences in the zone sizes for x86_64 as the arch-specific code for x86_64 accounts the kernel image and the starting mem_maps as memory holes but the architecture-independent code accounts the memory as present.

The net reduction seems small but the big benefit of this set of patches is the reduction of 421 lines of architecture-specific code, some of which is very hairy. There should be a greater net reduction when other architectures use the same mechanisms for zone and hole sizing but I lack the hardware to test on.

Comments?

Additional credit;
Dave Hansen for the initial suggestion and comments on early patches Andy Whitcroft for reviewing early versions and catching numerous errors Tony Luck for testing and debugging on IA64
Bob Picco for testing and fixing bugs related to pfn registration Jack Steiner and Yasunori for testing on IA64
Andi Kleen for reviewing and feeding back about x86_64

 arch/i386/Kconfig           |    8 
 arch/i386/kernel/setup.c    |   19 
 arch/i386/kernel/srat.c     |  101 ---
 arch/i386/mm/discontig.c    |   65 --
 arch/ia64/Kconfig           |    3 
 arch/ia64/mm/contig.c       |   60 --
 arch/ia64/mm/discontig.c    |   41 -
 arch/ia64/mm/init.c         |   12 
 arch/powerpc/Kconfig        |   13 
 arch/powerpc/mm/mem.c       |   53 --
 arch/powerpc/mm/numa.c      |  157 ------
 arch/ppc/Kconfig            |    3 
 arch/ppc/mm/init.c          |   26 -
 arch/x86_64/Kconfig         |    3 
 arch/x86_64/kernel/e820.c   |  109 +---
 arch/x86_64/kernel/setup.c  |    7 
 arch/x86_64/mm/init.c       |   62 --
 arch/x86_64/mm/k8topology.c |    3 
 arch/x86_64/mm/numa.c       |   18 
 arch/x86_64/mm/srat.c       |   11 
 include/asm-ia64/meminit.h  |    1 
 include/asm-x86_64/e820.h   |    5 
 include/asm-x86_64/proto.h  |    2 
 include/linux/mm.h          |   34 +
 include/linux/mmzone.h      |   10 
 mm/Makefile                 |    2 
 mm/mem_init.c               | 1121 ++++++++++++++++++++++++++++++++++++++++++
 mm/page_alloc.c             |  750 -----------------------------
Signature · 10 lines
-- 
Mel Gorman
Part-time Phd Student                          Linux Technology Center
University of Limerick                         IBM Dublin Software Lab

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
author
#1 lore raw

PATCH 1/6 Introduce mechanism for registering active regions of memory

This patch defines the structure to represent an active range of page frames within a node in an architecture independent manner. Architectures are expected to register active ranges of PFNs using add_active_range(nid, start_pfn, end_pfn) and call free_area_init_nodes() passing the PFNs of the end of each zone.

 include/linux/mm.h     |   34 +++
 include/linux/mmzone.h |   10 -
 mm/page_alloc.c        |  403 +++++++++++++++++++++++++++++++++++++++++---
 3 files changed, 422 insertions(+), 25 deletions(-)
include/linux/mm.h +34 -0
diff -rup -X /usr/src/patchset-0.5/bin//dontdiff linux-2.6.17-rc3-mm1-clean/include/linux/mm.h linux-2.6.17-rc3-mm1-101-add_free_area_init_nodes/include/linux/mm.h
@@ -916,6 +916,40 @@ extern void free_area_init(unsigned long
 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);
+#ifdef CONFIG_ARCH_POPULATES_NODE_MAP
+/*
+ * Any architecture that supports CONFIG_ARCH_POPULATES_NODE_MAP can
+ * initialise zone and hole information by
+ *
+ * for_all_memory_regions()
+ * 	add_active_range(nid, start, end)
+ * free_area_init_nodes(max_dma, max_dma32, max_low_pfn, max_pfn);
+ *
+ * Optionally, free_bootmem_with_active_regions() can be used to call
+ * free_bootmem_node() after active regions have been registered with
+ * add_active_range(). Similarly, sparse_memory_present_with_active_regions()
+ * calls memory_present() for active regions when SPARSEMEM is enabled
+ */
+extern void free_area_init_nodes(unsigned long max_dma_pfn,
+					unsigned long max_dma32_pfn,
+					unsigned long max_low_pfn,
+					unsigned long max_high_pfn);
+extern void add_active_range(unsigned int nid, unsigned long start_pfn,
+					unsigned long end_pfn);
+extern void shrink_active_range(unsigned int nid, unsigned long old_end_pfn,
+						unsigned long new_end_pfn);
+extern void remove_all_active_ranges(void);
+extern unsigned long absent_pages_in_range(unsigned long start_pfn,
+						unsigned long end_pfn);
+extern void get_pfn_range_for_nid(unsigned int nid,
+			unsigned long *start_pfn, unsigned long *end_pfn);
+extern unsigned long find_min_pfn_with_active_regions(void);
+extern unsigned long find_max_pfn_with_active_regions(void);
+extern int early_pfn_to_nid(unsigned long pfn);
+extern void free_bootmem_with_active_regions(int nid,
+						unsigned long max_low_pfn);
+extern void sparse_memory_present_with_active_regions(int nid);
+#endif
 extern void memmap_init_zone(unsigned long, int, unsigned long, unsigned long);
 extern void setup_per_zone_pages_min(void);
 extern void mem_init(void);
include/linux/mmzone.h +9 -1
diff -rup -X /usr/src/patchset-0.5/bin//dontdiff linux-2.6.17-rc3-mm1-clean/include/linux/mmzone.h linux-2.6.17-rc3-mm1-101-add_free_area_init_nodes/include/linux/mmzone.h
@@ -271,6 +271,13 @@ struct zonelist {
 	struct zone *zones[MAX_NUMNODES * MAX_NR_ZONES + 1]; // NULL delimited
 };
 
+#ifdef CONFIG_ARCH_POPULATES_NODE_MAP
+struct node_active_region {
+	unsigned long start_pfn;
+	unsigned long end_pfn;
+	int nid;
+};
+#endif /* CONFIG_ARCH_POPULATES_NODE_MAP */
 
 /*
  * The pg_data_t structure is used in machines with CONFIG_DISCONTIGMEM
@@ -468,7 +475,8 @@ extern struct zone *next_zone(struct zon
 
 #endif
 
-#ifndef CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID
+#if !defined(CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID) && \
+	!defined(CONFIG_ARCH_POPULATES_NODE_MAP)
 #define early_pfn_to_nid(nid)  (0UL)
 #endif
 
mm/page_alloc.c +379 -24

445 lines not on this page · raw message

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

author
#2 lore raw

PATCH 2/6 Have Power use add_active_range() and free_area_init_nodes()

In reply to Mel Gorman

Size zones and holes in an architecture independent manner for Power.

 powerpc/Kconfig   |   13 ++--
 powerpc/mm/mem.c  |   53 ++++++----------
 powerpc/mm/numa.c |  157 ++++---------------------------------------------
 ppc/Kconfig       |    3 
 ppc/mm/init.c     |   26 ++++----
 5 files changed, 62 insertions(+), 190 deletions(-)
arch/powerpc/Kconfig +9 -4
diff -rup -X /usr/src/patchset-0.5/bin//dontdiff linux-2.6.17-rc3-mm1-101-add_free_area_init_nodes/arch/powerpc/Kconfig linux-2.6.17-rc3-mm1-102-powerpc_use_init_nodes/arch/powerpc/Kconfig
@@ -676,11 +676,16 @@ config ARCH_SPARSEMEM_DEFAULT
 	def_bool y
 	depends on SMP && PPC_PSERIES
 
-source "mm/Kconfig"
-
-config HAVE_ARCH_EARLY_PFN_TO_NID
+config ARCH_POPULATES_NODE_MAP
 	def_bool y
-	depends on NEED_MULTIPLE_NODES
+
+# Value of 256 is MAX_LMB_REGIONS * 2
+config MAX_ACTIVE_REGIONS
+	int
+	default 256
+	depends on ARCH_POPULATES_NODE_MAP
+
+source "mm/Kconfig"
 
 config ARCH_MEMORY_PROBE
 	def_bool y
arch/powerpc/mm/mem.c +22 -31

85 lines not on this page · raw message

arch/powerpc/mm/numa.c +14 -143

207 lines not on this page · raw message

arch/ppc/Kconfig +3 -0
diff -rup -X /usr/src/patchset-0.5/bin//dontdiff linux-2.6.17-rc3-mm1-101-add_free_area_init_nodes/arch/ppc/Kconfig linux-2.6.17-rc3-mm1-102-powerpc_use_init_nodes/arch/ppc/Kconfig
@@ -949,6 +949,9 @@ config NR_CPUS
 config HIGHMEM
 	bool "High memory support"
 
+config ARCH_POPULATES_NODE_MAP
+	def_bool y
+
 source kernel/Kconfig.hz
 source kernel/Kconfig.preempt
 source "mm/Kconfig"
arch/ppc/mm/init.c +14 -12
diff -rup -X /usr/src/patchset-0.5/bin//dontdiff linux-2.6.17-rc3-mm1-101-add_free_area_init_nodes/arch/ppc/mm/init.c linux-2.6.17-rc3-mm1-102-powerpc_use_init_nodes/arch/ppc/mm/init.c
@@ -359,8 +359,7 @@ void __init do_init_bootmem(void)
  */
 void __init paging_init(void)
 {
-	unsigned long zones_size[MAX_NR_ZONES], i;
-
+	unsigned long start_pfn, end_pfn;
 #ifdef CONFIG_HIGHMEM
 	map_page(PKMAP_BASE, 0, 0);	/* XXX gross */
 	pkmap_page_table = pte_offset_kernel(pmd_offset(pgd_offset_k
@@ -370,19 +369,22 @@ void __init paging_init(void)
 			(KMAP_FIX_BEGIN), KMAP_FIX_BEGIN), KMAP_FIX_BEGIN);
 	kmap_prot = PAGE_KERNEL;
 #endif /* CONFIG_HIGHMEM */
-
-	/*
-	 * All pages are DMA-able so we put them all in the DMA zone.
-	 */
-	zones_size[ZONE_DMA] = total_lowmem >> PAGE_SHIFT;
-	for (i = 1; i < MAX_NR_ZONES; i++)
-		zones_size[i] = 0;
+	/* All pages are DMA-able so we put them all in the DMA zone. */
+	start_pfn = __pa(PAGE_OFFSET) >> PAGE_SHIFT;
+	end_pfn = start_pfn + (total_memory >> PAGE_SHIFT);
+	add_active_range(0, start_pfn, end_pfn);
 
 #ifdef CONFIG_HIGHMEM
-	zones_size[ZONE_HIGHMEM] = (total_memory - total_lowmem) >> PAGE_SHIFT;
+	free_area_init_nodes(total_lowmem >> PAGE_SHIFT,
+				total_lowmem >> PAGE_SHIFT,
+				total_lowmem >> PAGE_SHIFT,
+				total_memory >> PAGE_SHIFT);
+#else
+	free_area_init_nodes(total_memory >> PAGE_SHIFT,
+				total_memory >> PAGE_SHIFT,
+				total_memory >> PAGE_SHIFT,
+				total_memory >> PAGE_SHIFT);
 #endif /* CONFIG_HIGHMEM */
-
-	free_area_init(zones_size);
 }
 
 void __init mem_init(void)

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

author
#3 lore raw

PATCH 3/6 Have x86 use add_active_range() and free_area_init_nodes

In reply to Mel Gorman

Size zones and holes in an architecture independent manner for x86.

 Kconfig        |    8 +---
 kernel/setup.c |   19 +++------
 kernel/srat.c  |  100 +---------------------------------------------------
 mm/discontig.c |   65 +++++++--------------------------
 4 files changed, 25 insertions(+), 167 deletions(-)
arch/i386/Kconfig +3 -5
diff -rup -X /usr/src/patchset-0.5/bin//dontdiff linux-2.6.17-rc3-mm1-102-powerpc_use_init_nodes/arch/i386/Kconfig linux-2.6.17-rc3-mm1-103-x86_use_init_nodes/arch/i386/Kconfig
@@ -577,12 +577,10 @@ config ARCH_SELECT_MEMORY_MODEL
 	def_bool y
 	depends on ARCH_SPARSEMEM_ENABLE
 
-source "mm/Kconfig"
+config ARCH_POPULATES_NODE_MAP
+	def_bool y
 
-config HAVE_ARCH_EARLY_PFN_TO_NID
-	bool
-	default y
-	depends on NUMA
+source "mm/Kconfig"
 
 config HIGHPTE
 	bool "Allocate 3rd-level pagetables from highmem"
arch/i386/kernel/setup.c +6 -13
diff -rup -X /usr/src/patchset-0.5/bin//dontdiff linux-2.6.17-rc3-mm1-102-powerpc_use_init_nodes/arch/i386/kernel/setup.c linux-2.6.17-rc3-mm1-103-x86_use_init_nodes/arch/i386/kernel/setup.c
@@ -1207,22 +1207,15 @@ static unsigned long __init setup_memory
 
 void __init zone_sizes_init(void)
 {
-	unsigned long zones_size[MAX_NR_ZONES] = {0, 0, 0};
-	unsigned int max_dma, low;
+	unsigned int max_dma;
+#ifndef CONFIG_HIGHMEM
+	unsigned long highend_pfn = max_low_pfn;
+#endif
 
 	max_dma = virt_to_phys((char *)MAX_DMA_ADDRESS) >> PAGE_SHIFT;
-	low = max_low_pfn;
 
-	if (low < max_dma)
-		zones_size[ZONE_DMA] = low;
-	else {
-		zones_size[ZONE_DMA] = max_dma;
-		zones_size[ZONE_NORMAL] = low - max_dma;
-#ifdef CONFIG_HIGHMEM
-		zones_size[ZONE_HIGHMEM] = highend_pfn - low;
-#endif
-	}
-	free_area_init(zones_size);
+	add_active_range(0, 0, highend_pfn);
+	free_area_init_nodes(max_dma, max_dma, max_low_pfn, highend_pfn);
 }
 #else
 extern unsigned long __init setup_memory(void);
arch/i386/kernel/srat.c +2 -98

130 lines not on this page · raw message

arch/i386/mm/discontig.c +14 -51

92 lines not on this page · raw message

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

author
#4 lore raw

PATCH 4/6 Have x86_64 use add_active_range() and free_area_init_nodes

In reply to Mel Gorman

Size zones and holes in an architecture independent manner for x86_64.

 arch/x86_64/Kconfig         |    3 +
 arch/x86_64/kernel/e820.c   |  109 ++++++++++-----------------------------
 arch/x86_64/kernel/setup.c  |    7 ++
 arch/x86_64/mm/init.c       |   62 +---------------------
 arch/x86_64/mm/k8topology.c |    3 +
 arch/x86_64/mm/numa.c       |   18 +++---
 arch/x86_64/mm/srat.c       |   11 ++-
 include/asm-x86_64/e820.h   |    5 -
 include/asm-x86_64/proto.h  |    2 
 9 files changed, 63 insertions(+), 157 deletions(-)
arch/x86_64/Kconfig +3 -0
diff -rup -X /usr/src/patchset-0.5/bin//dontdiff linux-2.6.17-rc3-mm1-103-x86_use_init_nodes/arch/x86_64/Kconfig linux-2.6.17-rc3-mm1-104-x86_64_use_init_nodes/arch/x86_64/Kconfig
@@ -73,6 +73,9 @@ config ARCH_MAY_HAVE_PC_FDC
 	bool
 	default y
 
+config ARCH_POPULATES_NODE_MAP
+	def_bool y
+
 config DMI
 	bool
 	default y
arch/x86_64/kernel/e820.c +30 -79

140 lines not on this page · raw message

arch/x86_64/kernel/setup.c +6 -1
diff -rup -X /usr/src/patchset-0.5/bin//dontdiff linux-2.6.17-rc3-mm1-103-x86_use_init_nodes/arch/x86_64/kernel/setup.c linux-2.6.17-rc3-mm1-104-x86_64_use_init_nodes/arch/x86_64/kernel/setup.c
@@ -475,7 +475,8 @@ contig_initmem_init(unsigned long start_
 	if (bootmap == -1L)
 		panic("Cannot find bootmem map of size %ld\n",bootmap_size);
 	bootmap_size = init_bootmem(bootmap >> PAGE_SHIFT, end_pfn);
-	e820_bootmem_free(NODE_DATA(0), 0, end_pfn << PAGE_SHIFT);
+	e820_register_active_regions(0, start_pfn, end_pfn);
+	free_bootmem_with_active_regions(0, end_pfn);
 	reserve_bootmem(bootmap, bootmap_size);
 } 
 #endif
@@ -645,6 +646,7 @@ void __init setup_arch(char **cmdline_p)
 
 	early_identify_cpu(&boot_cpu_data);
 
+	e820_register_active_regions(0, 0, -1UL);
 	/*
 	 * partially used pages are not usable - thus
 	 * we are rounding upwards:
@@ -668,6 +670,9 @@ void __init setup_arch(char **cmdline_p)
 	acpi_boot_table_init();
 #endif
 
+	/* Remove active ranges so rediscovery with NUMA-awareness happens */
+	remove_all_active_ranges();
+
 #ifdef CONFIG_ACPI_NUMA
 	/*
 	 * Parse SRAT to discover nodes.
arch/x86_64/mm/init.c +3 -59

79 lines not on this page · raw message

arch/x86_64/mm/k8topology.c +3 -0
diff -rup -X /usr/src/patchset-0.5/bin//dontdiff linux-2.6.17-rc3-mm1-103-x86_use_init_nodes/arch/x86_64/mm/k8topology.c linux-2.6.17-rc3-mm1-104-x86_64_use_init_nodes/arch/x86_64/mm/k8topology.c
@@ -146,6 +146,9 @@ int __init k8_scan_nodes(unsigned long s
 		
 		nodes[nodeid].start = base; 
 		nodes[nodeid].end = limit;
+		e820_register_active_regions(nodeid,
+				nodes[nodeid].start >> PAGE_SHIFT,
+				nodes[nodeid].end >> PAGE_SHIFT);
 
 		prevbase = base;
 
arch/x86_64/mm/numa.c +9 -9
diff -rup -X /usr/src/patchset-0.5/bin//dontdiff linux-2.6.17-rc3-mm1-103-x86_use_init_nodes/arch/x86_64/mm/numa.c linux-2.6.17-rc3-mm1-104-x86_64_use_init_nodes/arch/x86_64/mm/numa.c
@@ -161,7 +161,7 @@ void __init setup_node_bootmem(int nodei
 					 bootmap_start >> PAGE_SHIFT, 
 					 start_pfn, end_pfn); 
 
-	e820_bootmem_free(NODE_DATA(nodeid), start, end);
+	free_bootmem_with_active_regions(nodeid, end);
 
 	reserve_bootmem_node(NODE_DATA(nodeid), nodedata_phys, pgdat_size); 
 	reserve_bootmem_node(NODE_DATA(nodeid), bootmap_start, bootmap_pages<<PAGE_SHIFT);
@@ -175,13 +175,11 @@ void __init setup_node_bootmem(int nodei
 void __init setup_node_zones(int nodeid)
 { 
 	unsigned long start_pfn, end_pfn, memmapsize, limit;
-	unsigned long zones[MAX_NR_ZONES];
-	unsigned long holes[MAX_NR_ZONES];
 
  	start_pfn = node_start_pfn(nodeid);
  	end_pfn = node_end_pfn(nodeid);
 
-	Dprintk(KERN_INFO "Setting up node %d %lx-%lx\n",
+	Dprintk(KERN_INFO "Setting up memmap for node %d %lx-%lx\n",
 		nodeid, start_pfn, end_pfn);
 
 	/* Try to allocate mem_map at end to not fill up precious <4GB
@@ -195,10 +193,6 @@ void __init setup_node_zones(int nodeid)
 				round_down(limit - memmapsize, PAGE_SIZE), 
 				limit);
 #endif
-
-	size_zones(zones, holes, start_pfn, end_pfn);
-	free_area_init_node(nodeid, NODE_DATA(nodeid), zones,
-			    start_pfn, holes);
 } 
 
 void __init numa_init_array(void)
@@ -259,8 +253,11 @@ static int numa_emulation(unsigned long 
  		printk(KERN_ERR "No NUMA hash function found. Emulation disabled.\n");
  		return -1;
  	}
- 	for_each_online_node(i)
+ 	for_each_online_node(i) {
+		e820_register_active_regions(i, nodes[i].start >> PAGE_SHIFT,
+						nodes[i].end >> PAGE_SHIFT);
  		setup_node_bootmem(i, nodes[i].start, nodes[i].end);
+	}
  	numa_init_array();
  	return 0;
 }
@@ -299,6 +296,7 @@ void __init numa_initmem_init(unsigned l
 	for (i = 0; i < NR_CPUS; i++)
 		numa_set_node(i, 0);
 	node_to_cpumask[0] = cpumask_of_cpu(0);
+	e820_register_active_regions(0, start_pfn, end_pfn);
 	setup_node_bootmem(0, start_pfn << PAGE_SHIFT, end_pfn << PAGE_SHIFT);
 }
 
@@ -346,6 +344,8 @@ void __init paging_init(void)
 	for_each_online_node(i) {
 		setup_node_zones(i); 
 	}
+
+	free_area_init_nodes(MAX_DMA_PFN, MAX_DMA32_PFN, end_pfn, end_pfn);
 } 
 
 /* [numa=off] */
arch/x86_64/mm/srat.c +7 -4
diff -rup -X /usr/src/patchset-0.5/bin//dontdiff linux-2.6.17-rc3-mm1-103-x86_use_init_nodes/arch/x86_64/mm/srat.c linux-2.6.17-rc3-mm1-104-x86_64_use_init_nodes/arch/x86_64/mm/srat.c
@@ -87,6 +87,7 @@ static __init void bad_srat(void)
 		apicid_to_node[i] = NUMA_NO_NODE;
 	for (i = 0; i < MAX_NUMNODES; i++)
 		nodes_add[i].start = nodes[i].end = 0;
+	remove_all_active_ranges();
 }
 
 static __init inline int srat_disabled(void)
@@ -168,7 +169,7 @@ static int hotadd_enough_memory(struct b
 
 	if (mem < 0)
 		return 0;
-	allowed = (end_pfn - e820_hole_size(0, end_pfn)) * PAGE_SIZE;
+	allowed = (end_pfn - absent_pages_in_range(0, end_pfn)) * PAGE_SIZE;
 	allowed = (allowed / 100) * hotadd_percent;
 	if (allocated + mem > allowed) {
 		/* Give them at least part of their hotadd memory upto hotadd_percent
@@ -216,7 +217,7 @@ static int reserve_hotadd(int node, unsi
 	}
 
 	/* This check might be a bit too strict, but I'm keeping it for now. */
-	if (e820_hole_size(s_pfn, e_pfn) != e_pfn - s_pfn) {
+	if (absent_pages_in_range(s_pfn, e_pfn) != e_pfn - s_pfn) {
 		printk(KERN_ERR "SRAT: Hotplug area has existing memory\n");
 		return -1;
 	}
@@ -310,6 +311,8 @@ acpi_numa_memory_affinity_init(struct ac
 
 	printk(KERN_INFO "SRAT: Node %u PXM %u %Lx-%Lx\n", node, pxm,
 	       nd->start, nd->end);
+	e820_register_active_regions(node, nd->start >> PAGE_SHIFT,
+						nd->end >> PAGE_SHIFT);
 
 #ifdef RESERVE_HOTADD
  	if (ma->flags.hot_pluggable && reserve_hotadd(node, start, end) < 0) {
@@ -334,13 +337,13 @@ static int nodes_cover_memory(void)
 		unsigned long s = nodes[i].start >> PAGE_SHIFT;
 		unsigned long e = nodes[i].end >> PAGE_SHIFT;
 		pxmram += e - s;
-		pxmram -= e820_hole_size(s, e);
+		pxmram -= absent_pages_in_range(s, e);
 		pxmram -= nodes_add[i].end - nodes_add[i].start;
 		if ((long)pxmram < 0)
 			pxmram = 0;
 	}
 
-	e820ram = end_pfn - e820_hole_size(0, end_pfn);
+	e820ram = end_pfn - absent_pages_in_range(0, end_pfn);
 	/* We seem to lose 3 pages somewhere. Allow a bit of slack. */
 	if ((long)(e820ram - pxmram) >= 1*1024*1024) {
 		printk(KERN_ERR
include/asm-x86_64/e820.h +2 -3
diff -rup -X /usr/src/patchset-0.5/bin//dontdiff linux-2.6.17-rc3-mm1-103-x86_use_init_nodes/include/asm-x86_64/e820.h linux-2.6.17-rc3-mm1-104-x86_64_use_init_nodes/include/asm-x86_64/e820.h
@@ -50,10 +50,9 @@ extern void e820_print_map(char *who);
 extern int e820_any_mapped(unsigned long start, unsigned long end, unsigned type);
 extern int e820_all_mapped(unsigned long start, unsigned long end, unsigned type);
 
-extern void e820_bootmem_free(pg_data_t *pgdat, unsigned long start,unsigned long end);
 extern void e820_setup_gap(void);
-extern unsigned long e820_hole_size(unsigned long start_pfn,
-				    unsigned long end_pfn);
+extern void e820_register_active_regions(int nid,
+				unsigned long start_pfn, unsigned long end_pfn);
 
 extern void __init parse_memopt(char *p, char **end);
 extern void __init parse_memmapopt(char *p, char **end);
include/asm-x86_64/proto.h +0 -2
diff -rup -X /usr/src/patchset-0.5/bin//dontdiff linux-2.6.17-rc3-mm1-103-x86_use_init_nodes/include/asm-x86_64/proto.h linux-2.6.17-rc3-mm1-104-x86_64_use_init_nodes/include/asm-x86_64/proto.h
@@ -24,8 +24,6 @@ extern void mtrr_bp_init(void);
 #define mtrr_bp_init() do {} while (0)
 #endif
 extern void init_memory_mapping(unsigned long start, unsigned long end);
-extern void size_zones(unsigned long *z, unsigned long *h,
-			unsigned long start_pfn, unsigned long end_pfn);
 
 extern void system_call(void); 
 extern int kernel_syscall(void);

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

author
#15 lore raw

PATCH 5/6 Have ia64 use add_active_range() and free_area_init_nodes

In reply to Mel Gorman

Size zones and holes in an architecture independent manner for ia64.

 arch/ia64/Kconfig          |    3 ++
 arch/ia64/mm/contig.c      |   60 +++++-----------------------------------
 arch/ia64/mm/discontig.c   |   41 ++++-----------------------
 arch/ia64/mm/init.c        |   12 ++++++++
 include/asm-ia64/meminit.h |    1 
 5 files changed, 30 insertions(+), 87 deletions(-)
arch/ia64/Kconfig +3 -0
diff -rup -X /usr/src/patchset-0.5/bin//dontdiff linux-2.6.17-rc3-mm1-104-x86_64_use_init_nodes/arch/ia64/Kconfig linux-2.6.17-rc3-mm1-105-ia64_use_init_nodes/arch/ia64/Kconfig
@@ -353,6 +353,9 @@ config NODES_SHIFT
 	  MAX_NUMNODES will be 2^(This value).
 	  If in doubt, use the default.
 
+config ARCH_POPULATES_NODE_MAP
+	def_bool y
+
 # VIRTUAL_MEM_MAP and FLAT_NODE_MEM_MAP are functionally equivalent.
 # VIRTUAL_MEM_MAP has been retained for historical reasons.
 config VIRTUAL_MEM_MAP
arch/ia64/mm/contig.c +8 -52

102 lines not on this page · raw message

arch/ia64/mm/discontig.c +6 -35

67 lines not on this page · raw message

arch/ia64/mm/init.c +12 -0
diff -rup -X /usr/src/patchset-0.5/bin//dontdiff linux-2.6.17-rc3-mm1-104-x86_64_use_init_nodes/arch/ia64/mm/init.c linux-2.6.17-rc3-mm1-105-ia64_use_init_nodes/arch/ia64/mm/init.c
@@ -539,6 +539,18 @@ find_largest_hole (u64 start, u64 end, v
 	last_end = end;
 	return 0;
 }
+
+int __init
+register_active_ranges(u64 start, u64 end, void *nid)
+{
+	BUG_ON(nid == NULL);
+	BUG_ON(*(unsigned long *)nid >= MAX_NUMNODES);
+
+	add_active_range(*(unsigned long *)nid,
+				__pa(start) >> PAGE_SHIFT,
+				__pa(end) >> PAGE_SHIFT);
+	return 0;
+}
 #endif /* CONFIG_VIRTUAL_MEM_MAP */
 
 static int __init
include/asm-ia64/meminit.h +1 -0
diff -rup -X /usr/src/patchset-0.5/bin//dontdiff linux-2.6.17-rc3-mm1-104-x86_64_use_init_nodes/include/asm-ia64/meminit.h linux-2.6.17-rc3-mm1-105-ia64_use_init_nodes/include/asm-ia64/meminit.h
@@ -56,6 +56,7 @@ extern void efi_memmap_init(unsigned lon
   extern unsigned long vmalloc_end;
   extern struct page *vmem_map;
   extern int find_largest_hole (u64 start, u64 end, void *arg);
+  extern int register_active_ranges (u64 start, u64 end, void *arg);
   extern int create_mem_map_page_table (u64 start, u64 end, void *arg);
 #endif
 

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

author
#30 lore raw

PATCH 6/6 Break out memory initialisation code from page_alloc.c to mem_init.c

In reply to Mel Gorman

page_alloc.c contains a large amount of memory initialisation code. This patch breaks out the initialisation code to a separate file to make page_alloc.c a bit easier to read.

 Makefile     |    2 
 mem_init.c   | 1123 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 page_alloc.c | 1105 -----------------------------------------------------
 3 files changed, 1124 insertions(+), 1106 deletions(-)
mm/Makefile +1 -1
diff -rup -X /usr/src/patchset-0.5/bin//dontdiff linux-2.6.17-rc3-mm1-105-ia64_use_init_nodes/mm/Makefile linux-2.6.17-rc3-mm1-106-breakout_mem_init/mm/Makefile
@@ -8,7 +8,7 @@ mmu-$(CONFIG_MMU)	:= fremap.o highmem.o 
 			   vmalloc.o
 
 obj-y			:= bootmem.o filemap.o mempool.o oom_kill.o fadvise.o \
-			   page_alloc.o page-writeback.o pdflush.o \
+			   page_alloc.o mem_init.o page-writeback.o pdflush.o \
 			   readahead.o swap.o truncate.o vmscan.o \
 			   prio_tree.o util.o mmzone.o $(mmu-y)
 
mm/mem_init.c +1123 -0

1,123 lines not on this page · raw message

mm/page_alloc.c +0 -1105

1,140 lines not on this page · raw message

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#31 lore raw

Re: [PATCH 6/6] Break out memory initialisation code from page_alloc.c to mem_init.c

Quoted 4 lines · Mel Gorman

page_alloc.c contains a large amount of memory initialisation code. This patch breaks out the initialisation code to a separate file to make page_alloc.c a bit easier to read.

I realise this is at the wrong end of your queue, but if you _can_ easily break it out and submit it first, it would be a nice cleanup and would help shrink your main patchset.

Also, we're recently having some problems with architectures not aligning zones correctly. Would it make sense to add these sorts of sanity checks, and possibly forcing alignment corrections into your generic code?

Nick
--

Send instant messages to your online friends http://au.messenger.yahoo.com

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

author
#32 lore raw

Re: [PATCH 6/6] Break out memory initialisation code from page_alloc.c to mem_init.c

Quoted 11 lines · Nick Piggin
Quoted 4 lines · Mel Gorman

page_alloc.c contains a large amount of memory initialisation code. This patch breaks out the initialisation code to a separate file to make page_alloc.c a bit easier to read.

I realise this is at the wrong end of your queue, but if you _can_ easily break it out and submit it first, it would be a nice cleanup and would help shrink your main patchset.

The split-out potentially affects 10 other patches currently in -mm and is a merge headache for Andrew. My current understanding is that he wants to drop patch 6/6 until a later time. I guess this would be still true if the patch was at the other end of the queue.

Quoted 4 lines

Also, we're recently having some problems with architectures not aligning zones correctly. Would it make sense to add these sorts of sanity checks, and possibly forcing alignment corrections into your generic code?

Yes, it is easy to force alignment corrections into the generic code. From that thread, there was this comment from Andy Whitcroft and your response;

Quoted 4 lines
Quoted 2 lines

1) check the alignment of the zones matches the implied alignment constraints and correct it as we go.

Yes. And preferably have checks in the generic page allocator setup code, so we can do something sane if the arch code gets it wrong.

With this patchset, it is trivial to move the start of highmem during setup. free_area_init_nodes() is passed the PFN each zone starts at by the architecture. If one wanted to force HIGHMEM to aligned, the arch_max_high_pfn value could be rounded down to MAX_ORDER alignment in free_area_init_nodes() before it calls free_area_init_node(). It doesn't matter if the PFN is in a hole. From there, an aligned mem_map should be allocated and memmap_init() will set the correct zone flags.

Signature · 9 lines
Mel Gorman
Part-time Phd Student                          Linux Technology Center
University of Limerick                         IBM Dublin Software Lab

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
#16 lore raw

Re: [PATCH 5/6] Have ia64 use add_active_range() and free_area_init_nodes

In reply to Mel Gorman
Quoted 3 lines · Mel Gorman

Size zones and holes in an architecture independent manner for ia64.

This one makes my ia64 die very early in boot. The trace is pretty useless.

config at http://www.zip.com.au/~akpm/linux/patches/stuff/config-ia64

EFI v1.10 by INTEL: SALsystab=0x3fe4c8c0 ACPI=0x3ff84000 ACPI 2.0=0x3ff83000 MP0 Early serial console at I/O port 0x2f8 (options '9600n8')
SAL 3.1: Intel Corp SR870BN4 vers0
SAL Platform features: BusLock IRQ_Redirection
SAL: AP wakeup using external interrupt vector 0xf0
No logical to physical processor mapping available
iosapic_system_init: Disabling PC-AT compatible 8259 interrupts
ACPI: Local APIC address c0000000fee00000
PLATFORM int CPEI (0x3): GSI 22 (level, low) -> CPU 0 (0xc618) vector 30
register_intr: changing vector 39 from IO-SAPIC-edge to IO-SAPIC-level 4 CPUs available, 4 CPUs total
MCA related initialization done
node 0 zone DMA missaligned start pfn, enable UNALIGNED_ZONE_BOUNDRIES node 0 zone DMA32 missaligned start pfn, enable UNALIGNED_ZONE_BOUNDRIES node 0 zone Normal missaligned start pfn, enable UNALIGNED_ZONE_BOUNDRIES node 0 zone HighMem missaligned start pfn, enable UNALIGNED_ZONE_BOUNDRIES
SMP: Allowing 4 CPUs, 0 hotplug CPUs
Built 1 zonelists
Kernel command line: BOOT_IMAGE=scsi0:\EFI\redhat\vmlinuz-2.6.17-rc4-mm1 root=/o PID hash table entries: 4096 (order: 12, 32768 bytes)
Console: colour VGA+ 80x25
Dentry cache hash table entries: 131072 (order: 6, 1048576 bytes) Inode-cache hash table entries: 65536 (order: 5, 524288 bytes) Placing software IO TLB between 0x4a30000 - 0x8a30000

Unable to handle kernel NULL pointer dereference (address 0000000000000008)
swapper[0]: Oops 8813272891392 [1]
Modules linked in:

Pid: 0, CPU 0, comm: swapper
psr : 00001010084a6010 ifs : 800000000000060f ip : [<a0000001000e6750>] Notd
ip is at __free_pages_ok+0x190/0x3c0
unat: 0000000000000000 pfs : 000000000000060f rsc : 0000000000000003
rnat: 0000000000ffffff bsps: 00000000000002f9 pr : 80000000afb5956b
ldrs: 0000000000000000 ccv : 0000000000000000 fpsr: 0009804c8a70433f csd : 0930ffff00090000 ssd : 0930ffff00090000
b0 : a0000001000e6660 b6 : e00000003fe52940 b7 : a000000100790120 f6 : 1003e6db6db6db6db6db7 f7 : 1003e000000000006dec0 f8 : 1003e000000000000fb80 f9 : 1003e000000000006e080 f10 : 1003e000000000000fb40 f11 : 1003e000000000006dec0 r1 : a000000100af2db0 r2 : 0000000000000001 r3 : 0000000000000000 r8 : a0000001008f3d38 r9 : 0000000000004000 r10 : 0000000000370400 r11 : 0000000000004000 r12 : a0000001007b7e10 r13 : a0000001007b0000 r14 : 0000000000000001 r15 : 0000000100000001 r16 : 0000000100000001 r17 : 0000000100000001 r18 : 0000000000001041 r19 : 0000000000000000 r20 : e00000000149df00 r21 : 0000000100000000 r22 : 0000000055555155 r23 : 00000000ffffffff r24 : e00000000149df08 r25 : 1555555555555155 r26 : 0000000000000032 r27 : 0000000000000000 r28 : 0000000000000008 r29 : 0000000000001041 r30 : 0000000000001041 r31 : 0000000000000001

Unable to handle kernel NULL pointer dereference (address 0000000000000000)
swapper[0]: Oops 8813272891392 [2]
Modules linked in:

Pid: 0, CPU 0, comm: swapper
psr : 0000101008022018 ifs : 8000000000000287 ip : [<a0000001001236c0>] Notd
ip is at kmem_cache_alloc+0x40/0x100
unat: 0000000000000000 pfs : 0000000000000712 rsc : 0000000000000003
rnat: 0000000000000000 bsps: 0000000000000000 pr : 80000000afb59967
ldrs: 0000000000000000 ccv : 0000000000000000 fpsr: 0009804c8a70033f csd : 0930ffff00090000 ssd : 0930ffff00090000
b0 : a00000010003e450 b6 : a000000100001b50 b7 : a00000010003f320 f6 : 1003e9e3779b97f4a7c16 f7 : 0ffdb8000000000000000 f8 : 1003e000000000000007f f9 : 1003e0000000000000379 f10 : 1003e6db6db6db6db6db7 f11 : 1003e000000000000007f r1 : a000000100af2db0 r2 : 0000000000000000 r3 : 0000000000000000 r8 : 0000000000000000 r9 : 0000000000000000 r10 : a0000001007b0f24 r11 : 0000000000000000 r12 : a0000001007b7280 r13 : a0000001007b0000 r14 : 0000000000000000 r15 : 0000000000000000 r16 : a0000001007b7310 r17 : 0000000000000000 r18 : a0000001007b7478 r19 : 0000000000000000 r20 : 0000000000000000 r21 : 0000000000000018 r22 : 0000000000000000 r23 : 0000000000000000 r24 : 0000000000000000 r25 : a0000001007b7308 r26 : 000000007fffffff r27 : a000000100825520 r28 : a0000001008f3c40 r29 : a000000100816ca8 r30 : 0000000000000018 r31 : 0000000000000018

(gdb) l *0xa0000001000e6750 0xa0000001000e6750 is in __free_pages_ok (mm.h:324).
319 extern void FASTCALL(__page_cache_release(struct page *));
320
321 static inline int page_count(struct page *page)
322 {
323 if (unlikely(PageCompound(page)))
324 page = (struct page *)page_private(page);
325 return atomic_read(&page->_count);
326 }
327
328 static inline void get_page(struct page *page)

Note the misaligned pfns.

Andy's (misspelled) CONFIG_UNALIGNED_ZONE_BOUNDRIES patch didn't actually include an update to any Kconfig files. But hacking that in by hand didn't help.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#17 lore raw

Re: [PATCH 5/6] Have ia64 use add_active_range() and free_area_init_nodes

Quoted 99 lines · Andrew Morton
Quoted 2 lines · Mel Gorman

Size zones and holes in an architecture independent manner for ia64.

This one makes my ia64 die very early in boot. The trace is pretty useless.

config at http://www.zip.com.au/~akpm/linux/patches/stuff/config-ia64

EFI v1.10 by INTEL: SALsystab=0x3fe4c8c0 ACPI=0x3ff84000 ACPI 2.0=0x3ff83000 MP0 Early serial console at I/O port 0x2f8 (options '9600n8')
SAL 3.1: Intel Corp SR870BN4 vers0
SAL Platform features: BusLock IRQ_Redirection
SAL: AP wakeup using external interrupt vector 0xf0
No logical to physical processor mapping available
iosapic_system_init: Disabling PC-AT compatible 8259 interrupts
ACPI: Local APIC address c0000000fee00000
PLATFORM int CPEI (0x3): GSI 22 (level, low) -> CPU 0 (0xc618) vector 30
register_intr: changing vector 39 from IO-SAPIC-edge to IO-SAPIC-level 4 CPUs available, 4 CPUs total
MCA related initialization done
node 0 zone DMA missaligned start pfn, enable UNALIGNED_ZONE_BOUNDRIES node 0 zone DMA32 missaligned start pfn, enable UNALIGNED_ZONE_BOUNDRIES node 0 zone Normal missaligned start pfn, enable UNALIGNED_ZONE_BOUNDRIES node 0 zone HighMem missaligned start pfn, enable UNALIGNED_ZONE_BOUNDRIES
SMP: Allowing 4 CPUs, 0 hotplug CPUs
Built 1 zonelists
Kernel command line: BOOT_IMAGE=scsi0:\EFI\redhat\vmlinuz-2.6.17-rc4-mm1 root=/o PID hash table entries: 4096 (order: 12, 32768 bytes)
Console: colour VGA+ 80x25
Dentry cache hash table entries: 131072 (order: 6, 1048576 bytes) Inode-cache hash table entries: 65536 (order: 5, 524288 bytes) Placing software IO TLB between 0x4a30000 - 0x8a30000

Unable to handle kernel NULL pointer dereference (address 0000000000000008)
swapper[0]: Oops 8813272891392 [1]
Modules linked in:

Pid: 0, CPU 0, comm: swapper
psr : 00001010084a6010 ifs : 800000000000060f ip : [<a0000001000e6750>] Notd
ip is at __free_pages_ok+0x190/0x3c0
unat: 0000000000000000 pfs : 000000000000060f rsc : 0000000000000003
rnat: 0000000000ffffff bsps: 00000000000002f9 pr : 80000000afb5956b
ldrs: 0000000000000000 ccv : 0000000000000000 fpsr: 0009804c8a70433f csd : 0930ffff00090000 ssd : 0930ffff00090000
b0 : a0000001000e6660 b6 : e00000003fe52940 b7 : a000000100790120 f6 : 1003e6db6db6db6db6db7 f7 : 1003e000000000006dec0 f8 : 1003e000000000000fb80 f9 : 1003e000000000006e080 f10 : 1003e000000000000fb40 f11 : 1003e000000000006dec0 r1 : a000000100af2db0 r2 : 0000000000000001 r3 : 0000000000000000 r8 : a0000001008f3d38 r9 : 0000000000004000 r10 : 0000000000370400 r11 : 0000000000004000 r12 : a0000001007b7e10 r13 : a0000001007b0000 r14 : 0000000000000001 r15 : 0000000100000001 r16 : 0000000100000001 r17 : 0000000100000001 r18 : 0000000000001041 r19 : 0000000000000000 r20 : e00000000149df00 r21 : 0000000100000000 r22 : 0000000055555155 r23 : 00000000ffffffff r24 : e00000000149df08 r25 : 1555555555555155 r26 : 0000000000000032 r27 : 0000000000000000 r28 : 0000000000000008 r29 : 0000000000001041 r30 : 0000000000001041 r31 : 0000000000000001

Unable to handle kernel NULL pointer dereference (address 0000000000000000)
swapper[0]: Oops 8813272891392 [2]
Modules linked in:

Pid: 0, CPU 0, comm: swapper
psr : 0000101008022018 ifs : 8000000000000287 ip : [<a0000001001236c0>] Notd
ip is at kmem_cache_alloc+0x40/0x100
unat: 0000000000000000 pfs : 0000000000000712 rsc : 0000000000000003
rnat: 0000000000000000 bsps: 0000000000000000 pr : 80000000afb59967
ldrs: 0000000000000000 ccv : 0000000000000000 fpsr: 0009804c8a70033f csd : 0930ffff00090000 ssd : 0930ffff00090000
b0 : a00000010003e450 b6 : a000000100001b50 b7 : a00000010003f320 f6 : 1003e9e3779b97f4a7c16 f7 : 0ffdb8000000000000000 f8 : 1003e000000000000007f f9 : 1003e0000000000000379 f10 : 1003e6db6db6db6db6db7 f11 : 1003e000000000000007f r1 : a000000100af2db0 r2 : 0000000000000000 r3 : 0000000000000000 r8 : 0000000000000000 r9 : 0000000000000000 r10 : a0000001007b0f24 r11 : 0000000000000000 r12 : a0000001007b7280 r13 : a0000001007b0000 r14 : 0000000000000000 r15 : 0000000000000000 r16 : a0000001007b7310 r17 : 0000000000000000 r18 : a0000001007b7478 r19 : 0000000000000000 r20 : 0000000000000000 r21 : 0000000000000018 r22 : 0000000000000000 r23 : 0000000000000000 r24 : 0000000000000000 r25 : a0000001007b7308 r26 : 000000007fffffff r27 : a000000100825520 r28 : a0000001008f3c40 r29 : a000000100816ca8 r30 : 0000000000000018 r31 : 0000000000000018

(gdb) l *0xa0000001000e6750 0xa0000001000e6750 is in __free_pages_ok (mm.h:324).
319 extern void FASTCALL(__page_cache_release(struct page *));
320
321 static inline int page_count(struct page *page)
322 {
323 if (unlikely(PageCompound(page)))
324 page = (struct page *)page_private(page);
325 return atomic_read(&page->_count);
326 }
327
328 static inline void get_page(struct page *page)

Quoted 5 lines

Note the misaligned pfns.

Andy's (misspelled) CONFIG_UNALIGNED_ZONE_BOUNDRIES patch didn't actually include an update to any Kconfig files. But hacking that in by hand didn't help.

Interesting. You are correct there was no config component, at the time I didn't have direct evidence that any architecture needed it, only that we had an unchecked requirement on zones, a requirement that had only recently arrived with the changes to free buddy detection. I note that MAX_ORDER is 17 for ia64 so that probabally accounts for the missalignment. It is clear that the reporting is slightly over-zelous as I am reporting zero-sized zones. I'll get that fixed and patch to you. I'll also have a look at the patch as added to -mm and try and get the rest of the spelling sorted :-/.

I'll go see if we currently have a machine to test this config on.

-apw

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#18 lore raw

Re: [PATCH 5/6] Have ia64 use add_active_range() and free_area_init_nodes

Quoted 4 lines · Andy Whitcroft

Interesting. You are correct there was no config component, at the time I didn't have direct evidence that any architecture needed it, only that we had an unchecked requirement on zones, a requirement that had only recently arrived with the changes to free buddy detection. I note that

Recently arrived? Over a year ago with the no-buddy-bitmap patches, right? Just checking because I that's what I'm assuming broke it...

Quoted 7 lines

MAX_ORDER is 17 for ia64 so that probabally accounts for the missalignment. It is clear that the reporting is slightly over-zelous as I am reporting zero-sized zones. I'll get that fixed and patch to you. I'll also have a look at the patch as added to -mm and try and get the rest of the spelling sorted :-/.

I'll go see if we currently have a machine to test this config on.

Signature · 8 lines
SUSE Labs, Novell Inc.
Send instant messages to your online friends http://au.messenger.yahoo.com 

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
#19 lore raw

Re: [PATCH 5/6] Have ia64 use add_active_range() and free_area_init_nodes

Quoted 10 lines · Nick Piggin
Quoted 4 lines · Andy Whitcroft

Interesting. You are correct there was no config component, at the time I didn't have direct evidence that any architecture needed it, only that we had an unchecked requirement on zones, a requirement that had only recently arrived with the changes to free buddy detection. I note that

Recently arrived? Over a year ago with the no-buddy-bitmap patches, right? Just checking because I that's what I'm assuming broke it...

Yep, sorry I forget I was out of the game for 6 months! And yes that was when the requirements were altered.

-apw

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#20 lore raw

Re: [PATCH 5/6] Have ia64 use add_active_range() and free_area_init_nodes

Quoted 9 lines · On Mon, 15 May 2006 11:19:27 +0100 Andy Whitcroft <[email protected]> wrote:
Quoted 8 lines · Nick Piggin
Quoted 4 lines · Andy Whitcroft

Interesting. You are correct there was no config component, at the time I didn't have direct evidence that any architecture needed it, only that we had an unchecked requirement on zones, a requirement that had only recently arrived with the changes to free buddy detection. I note that

Quoted 6 lines
Quoted 2 lines

Recently arrived? Over a year ago with the no-buddy-bitmap patches, right? Just checking because I that's what I'm assuming broke it...

Yep, sorry I forget I was out of the game for 6 months! And yes that was when the requirements were altered.

When no-bitmap-buddy patches was included,

1. bad_range() is not covered by CONFIG_VM_DEBUG. It always worked. ==
static int bad_range(struct zone *zone, struct page *page)

{
        if (page_to_pfn(page) >= zone->zone_start_pfn + zone->spanned_pages)
                return 1;
        if (page_to_pfn(page) < zone->zone_start_pfn)
                return 1;
==
And , this code
==
                buddy = __page_find_buddy(page, page_idx, order);

                if (bad_range(zone, buddy))
                        break;

==

checked whether buddy is in zone and guarantees it to have page struct.

But clean-up/speed-up codes vanished these checks. (I don't know when this occurs) Sorry for misses these things.

-Kame

#21 lore raw

Re: [PATCH 5/6] Have ia64 use add_active_range() and free_area_init_nodes

Quoted 35 lines · On Mon, 15 May 2006 19:29:18 +0900 KAMEZAWA Hiroyuki…
Quoted 9 lines · On Mon, 15 May 2006 11:19:27 +0100 Andy Whitcroft <[email protected]> wrote:
Quoted 8 lines · Nick Piggin
Quoted 4 lines · Andy Whitcroft

Interesting. You are correct there was no config component, at the time I didn't have direct evidence that any architecture needed it, only that we had an unchecked requirement on zones, a requirement that had only recently arrived with the changes to free buddy detection. I note that

Quoted 6 lines
Quoted 2 lines

Recently arrived? Over a year ago with the no-buddy-bitmap patches, right? Just checking because I that's what I'm assuming broke it...

Yep, sorry I forget I was out of the game for 6 months! And yes that was when the requirements were altered.

When no-bitmap-buddy patches was included,

1. bad_range() is not covered by CONFIG_VM_DEBUG. It always worked. ==
static int bad_range(struct zone *zone, struct page *page)

{
        if (page_to_pfn(page) >= zone->zone_start_pfn + zone->spanned_pages)
                return 1;
        if (page_to_pfn(page) < zone->zone_start_pfn)
                return 1;
==
And , this code
==
                buddy = __page_find_buddy(page, page_idx, order);

                if (bad_range(zone, buddy))
                        break;
Quoted 8 lines

==

checked whether buddy is in zone and guarantees it to have page struct.

But clean-up/speed-up codes vanished these checks. (I don't know when this occurs) Sorry for misses these things.

One more point
When above no-bitmap patches was included, the user of not-aligned zones are only ia64, I think. Because ia64 used virtual mem_map, page_to_pfn(page) on CONFIG_DISCONTIG_MEM doesn't access page struct itself.

#define page_to_pfn(page) (page - vmemmap)

So, it didn't panic. ia64/vmemmap was safe.

If other archs used not-aligned zone + CONFIG_DISCONTIGMEM, not-aligned-zones problem would come out earlier.

-Kame

#22 lore raw

Re: [PATCH 5/6] Have ia64 use add_active_range() and free_area_init_nodes

In reply to KAMEZAWA Hiroyuki
Quoted 39 lines · KAMEZAWA Hiroyuki
Quoted 11 lines · On Mon, 15 May 2006 11:19:27 +0100 Andy Whitcroft <[email protected]> wrote:
Quoted 9 lines · Nick Piggin
Quoted 4 lines · Andy Whitcroft

Interesting. You are correct there was no config component, at the time I didn't have direct evidence that any architecture needed it, only that we had an unchecked requirement on zones, a requirement that had only recently arrived with the changes to free buddy detection. I note that

Quoted 6 lines
Quoted 2 lines

Recently arrived? Over a year ago with the no-buddy-bitmap patches, right? Just checking because I that's what I'm assuming broke it...

Yep, sorry I forget I was out of the game for 6 months! And yes that was when the requirements were altered.

When no-bitmap-buddy patches was included,

1. bad_range() is not covered by CONFIG_VM_DEBUG. It always worked. ==
static int bad_range(struct zone *zone, struct page *page)

{
        if (page_to_pfn(page) >= zone->zone_start_pfn + zone->spanned_pages)
                return 1;
        if (page_to_pfn(page) < zone->zone_start_pfn)
                return 1;
==
And , this code
==
                buddy = __page_find_buddy(page, page_idx, order);

                if (bad_range(zone, buddy))
                        break;
Quoted 7 lines

==

checked whether buddy is in zone and guarantees it to have page struct.

But clean-up/speed-up codes vanished these checks. (I don't know when this occurs) Sorry for misses these things.

Heh, sorry to make it sound like it was you who was responsible.

-apw

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

author
#26 lore raw

Re: [PATCH 5/6] Have ia64 use add_active_range() and free_area_init_nodes

In reply to Andrew Morton

On (14/05/06 20:31), Andrew Morton didst pronounce:

Quoted 10 lines
Quoted 3 lines · Mel Gorman

Size zones and holes in an architecture independent manner for ia64.

This one makes my ia64 die very early in boot. The trace is pretty useless.

config at http://www.zip.com.au/~akpm/linux/patches/stuff/config-ia64

<log snipped>

Curses. When I tried to reproduce this, the machine booted with my default config but died before initialising the console with your config. The machine is far away so I can't see the screen or restart the machine remotely so I can only assume it is dying for the same reasons yours did.

Quoted 5 lines

Note the misaligned pfns.

Andy's (misspelled) CONFIG_UNALIGNED_ZONE_BOUNDRIES patch didn't actually include an update to any Kconfig files. But hacking that in by hand didn't help.

It would not have helped in this case because the zone boundaries would still be in the wrong place for ia64. Below is a patch that aligns the zones on all architectures that use CONFIG_ARCH_POPULATES_NODE_MAP . That is currently i386, x86_64, powerpc, ppc and ia64. It does *not* align pgdat->node_start_pfn but I don't believe that it is necessary.

I can't test it on ia64 until I get someone to restart the machine. The patch compiles and is currently boot-testing on a range of other machines. I hope to know within 5-6 hours if everything is ok.

mm/page_alloc.c +8 -2
diff -rup -X /usr/src/patchset-0.5/bin//dontdiff linux-2.6.17-rc4-mm4-clean/mm/page_alloc.c linux-2.6.17-rc4-mm4-ia64_force_alignment/mm/page_alloc.c
@@ -2640,14 +2640,20 @@ void __init free_area_init_nodes(unsigne
 {
 	unsigned long nid;
 	int zone_index;
+	unsigned long lowest_pfn = find_min_pfn_with_active_regions();
+
+	lowest_pfn = zone_boundary_align_pfn(lowest_pfn);
+	arch_max_dma_pfn = zone_boundary_align_pfn(arch_max_dma_pfn);
+	arch_max_dma32_pfn = zone_boundary_align_pfn(arch_max_dma32_pfn);
+	arch_max_low_pfn = zone_boundary_align_pfn(arch_max_low_pfn);
+	arch_max_high_pfn = zone_boundary_align_pfn(arch_max_high_pfn);
 
 	/* Record where the zone boundaries are */
 	memset(arch_zone_lowest_possible_pfn, 0,
 				sizeof(arch_zone_lowest_possible_pfn));
 	memset(arch_zone_highest_possible_pfn, 0,
 				sizeof(arch_zone_highest_possible_pfn));
-	arch_zone_lowest_possible_pfn[ZONE_DMA] =
-					find_min_pfn_with_active_regions();
+	arch_zone_lowest_possible_pfn[ZONE_DMA] = lowest_pfn;
 	arch_zone_highest_possible_pfn[ZONE_DMA] = arch_max_dma_pfn;
 	arch_zone_highest_possible_pfn[ZONE_DMA32] = arch_max_dma32_pfn;
 	arch_zone_highest_possible_pfn[ZONE_NORMAL] = arch_max_low_pfn;

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

author
#27 lore raw

Re: [PATCH 5/6] Have ia64 use add_active_range() and free_area_init_nodes

Quoted 17 lines

diff -rup -X /usr/src/patchset-0.5/bin//dontdiff linux-2.6.17-rc4-mm4-clean/mm/page_alloc.c linux-2.6.17-rc4-mm4-ia64_force_alignment/mm/page_alloc.c

mm/page_alloc.c +7 -0
@@ -2640,14 +2640,20 @@ void __init free_area_init_nodes(unsigne
 {
 	unsigned long nid;
 	int zone_index;
+	unsigned long lowest_pfn = find_min_pfn_with_active_regions();
+
+	lowest_pfn = zone_boundary_align_pfn(lowest_pfn);
+	arch_max_dma_pfn = zone_boundary_align_pfn(arch_max_dma_pfn);
+	arch_max_dma32_pfn = zone_boundary_align_pfn(arch_max_dma32_pfn);
+	arch_max_low_pfn = zone_boundary_align_pfn(arch_max_low_pfn);
+	arch_max_high_pfn = zone_boundary_align_pfn(arch_max_high_pfn);
 
 	/* Record where the zone boundaries are */

mm/page_alloc.c void __init free_area_init_nodes(unsigne · line 2659

Quoted 10 lines
mm/page_alloc.c +1 -2
 	memset(arch_zone_lowest_possible_pfn, 0,
 				sizeof(arch_zone_lowest_possible_pfn));
 	memset(arch_zone_highest_possible_pfn, 0,
 				sizeof(arch_zone_highest_possible_pfn));
-	arch_zone_lowest_possible_pfn[ZONE_DMA] =
-					find_min_pfn_with_active_regions();
+	arch_zone_lowest_possible_pfn[ZONE_DMA] = lowest_pfn;
 	arch_zone_highest_possible_pfn[ZONE_DMA] = arch_max_dma_pfn;
 	arch_zone_highest_possible_pfn[ZONE_DMA32] = arch_max_dma32_pfn;
 	arch_zone_highest_possible_pfn[ZONE_NORMAL] = arch_max_low_pfn;

Ok, this patch is broken in a number of ways. It doesn't help the IA64 problem at all and two other machine configurations failed with the patch applied during regression testing. Please drop and I'll figure out what the correct solution is to your IA64 machine not booting.

Signature · 9 lines
Mel Gorman
Part-time Phd Student                          Linux Technology Center
University of Limerick                         IBM Dublin Software Lab

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
#23 lore raw

Re: [PATCH 5/6] Have ia64 use add_active_range() and free_area_init_nodes

In reply to KAMEZAWA Hiroyuki
Quoted 28 lines · KAMEZAWA Hiroyuki
Quoted 8 lines · On Mon, 15 May 2006 11:19:27 +0100 Andy Whitcroft <[email protected]> wrote:
Quoted 4 lines

Recently arrived? Over a year ago with the no-buddy-bitmap patches, right? Just checking because I that's what I'm assuming broke it...

Yep, sorry I forget I was out of the game for 6 months! And yes that was when the requirements were altered.

When no-bitmap-buddy patches was included,

1. bad_range() is not covered by CONFIG_VM_DEBUG. It always worked. ==
static int bad_range(struct zone *zone, struct page *page)

{
       if (page_to_pfn(page) >= zone->zone_start_pfn + zone->spanned_pages)
               return 1;
       if (page_to_pfn(page) < zone->zone_start_pfn)
               return 1;
==
And , this code
==
               buddy = __page_find_buddy(page, page_idx, order);

               if (bad_range(zone, buddy))
                       break;
Quoted 4 lines

==

checked whether buddy is in zone and guarantees it to have page struct.

Ah, my mistake indeed. Sorry.

Quoted 3 lines

But clean-up/speed-up codes vanished these checks. (I don't know when this occurs) Sorry for misses these things.

I think if anything they should be moved into page_is_buddy, however page_to_pfn is expensive on some architectures, so it is something we want to be able to opt out of if we do the correct alignment.

--
Send instant messages to your online friends http://au.messenger.yahoo.com

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#24 lore raw

Re: [PATCH 5/6] Have ia64 use add_active_range() and free_area_init_nodes

Quoted 10 lines · On Tue, 16 May 2006 10:31:56 +1000 Nick Piggin <[email protected]> wrote:
Quoted 3 lines

But clean-up/speed-up codes vanished these checks. (I don't know when this occurs) Sorry for misses these things.

I think if anything they should be moved into page_is_buddy, however page_to_pfn
is expensive on some architectures, so it is something we want to be able to opt
out of if we do the correct alignment.

yes. It's expensive.
I received following e-Mail from Dave Hansen in past.
==
There are some ppc64 machines which have memory laid out like this:

0-100 MB Node0
100-200 MB Node1
200-300 MB Node0
==
I didn't imagine above (strange) configration.
So, simple range check will not work for all configration anyway. (above example is aligned and has no problem. Moreover, ppc uses SPARSEMEM.)

Andy's page_zone(page) == page_zone(buddy) check is good, I think.

Making alignment is a difficult problem, I think. It complecates many things. We can avoid above check only when memory layout is ideal.

BTW, How about following patch ?
I don't want to say "Oh, you have to re-compile your kernel with CONFIG_UNALIGNED_ZONE on your new machine. you are unlucky." to users.

==

mm/page_alloc.c +29 -13
Index: linux-2.6.17-rc4-mm1/mm/page_alloc.c
===================================================================
@@ -58,6 +58,7 @@ unsigned long totalhigh_pages __read_mos
 unsigned long totalreserve_pages __read_mostly;
 long nr_swap_pages;
 int percpu_pagelist_fraction;
+int unaligned_zone;
 
 static void __free_pages_ok(struct page *page, unsigned int order);
 
@@ -296,12 +297,12 @@ static inline void rmv_page_order(struct
  *
  * Assumption: *_mem_map is contigious at least up to MAX_ORDER
  */
-static inline struct page *
+static inline long *
 __page_find_buddy(struct page *page, unsigned long page_idx, unsigned int order)
 {
 	unsigned long buddy_idx = page_idx ^ (1 << order);
 
-	return page + (buddy_idx - page_idx);
+	return (buddy_idx - page_idx);
 }
 
 static inline unsigned long
@@ -310,6 +311,23 @@ __find_combined_index(unsigned long page
 	return (page_idx & ~(1 << order));
 }
 
+static inline struct page *
+buddy_in_range(struct zone *zone, struct page *page, long buddy_idx)
+{
+	unsigned long pfn;
+	struct page *buddy;
+	if (!unaligned_zone)
+		return page + buddy_idx;
+	pfn = page_to_pfn(page);
+	if (!pfn_valid(pfn + buddy_idx))
+		return NULL;
+	buddy = page + buddy_idx;
+	if (page_zone_id(page) != page_zone_id(buddy))
+		return NULL;
+	return buddy;
+}
+
+
 /*
  * This function checks whether a page is free && is the buddy
  * we can do coalesce a page and its buddy if
@@ -326,15 +344,10 @@ __find_combined_index(unsigned long page
 static inline int page_is_buddy(struct page *page, struct page *buddy,
 								int order)
 {
-#ifdef CONFIG_HOLES_IN_ZONE
+#if defined(CONFIG_HOLES_IN_ZONE)
 	if (!pfn_valid(page_to_pfn(buddy)))
 		return 0;
 #endif
-#ifdef CONFIG_UNALIGNED_ZONE_BOUNDRIES
-	if (page_zone_id(page) != page_zone_id(buddy))
-		return 0;
-#endif
-
 	if (PageBuddy(buddy) && page_order(buddy) == order) {
 		BUG_ON(page_count(buddy) != 0);
 		return 1;
@@ -383,10 +396,14 @@ static inline void __free_one_page(struc
 	zone->free_pages += order_size;
 	while (order < MAX_ORDER-1) {
 		unsigned long combined_idx;
+		long buddy_idx;
 		struct free_area *area;
 		struct page *buddy;
 
-		buddy = __page_find_buddy(page, page_idx, order);
+		buddy_idx = __page_find_buddy(page, page_idx, order);
+		buddy = buddy_in_zone(zone, page, buddy_idx);
+		if (unlikely(!buddy))
+			break;
 		if (!page_is_buddy(page, buddy, order))
 			break;		/* Move the buddy up one level. */
 
@@ -2434,10 +2451,9 @@ static void __meminit free_area_init_cor
 		struct zone *zone = pgdat->node_zones + j;
 		unsigned long size, realsize;
 
-		if (zone_boundary_align_pfn(zone_start_pfn) != zone_start_pfn)
-			printk(KERN_CRIT "node %d zone %s missaligned "
-				"start pfn, enable UNALIGNED_ZONE_BOUNDRIES\n",
-							nid, zone_names[j]);
+		if (zone_boundary_align_pfn(zone_start_pfn) != zone_start_pfn) {
+			unaligned_zone = 1;
+		}
 
 		size = zone_present_pages_in_node(nid, j, zones_size);
 		realsize = size - zone_absent_pages_in_node(nid, j,
include/linux/mmzone.h +0 -4
Index: linux-2.6.17-rc4-mm1/include/linux/mmzone.h
===================================================================
@@ -399,11 +399,7 @@ static inline int is_dma(struct zone *zo
 
 static inline unsigned long zone_boundary_align_pfn(unsigned long pfn)
 {
-#ifdef CONFIG_UNALIGNED_ZONE_BOUNDRIES
-	return pfn;
-#else
 	return pfn & ~((1 << MAX_ORDER) - 1);
-#endif
 }
 
 /* These two functions are used to setup the per zone pages min values */
#25 lore raw

Re: [PATCH 5/6] Have ia64 use add_active_range() and free_area_init_nodes

Quoted 9 lines · KAMEZAWA Hiroyuki

Andy's page_zone(page) == page_zone(buddy) check is good, I think.

Making alignment is a difficult problem, I think. It complecates many things. We can avoid above check only when memory layout is ideal.

BTW, How about following patch ?
I don't want to say "Oh, you have to re-compile your kernel with CONFIG_UNALIGNED_ZONE on your new machine. you are unlucky." to users.

No, this is a function of the architecture code, not the specific machine it is running on.

So if the architecture ensures alignment and no holes, then they don't need the overhead of CONFIG_UNALIGNED_ZONE or CONFIG_HOLES_IN_ZONE.

If they do not ensure correct alignment, then they must enable CONFIG_UNALIGNED_ZONE, even if there may be actual systems which do result in aligned zones.
--

Send instant messages to your online friends http://au.messenger.yahoo.com

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

author
#28 lore raw

Re: [PATCH 5/6] Have ia64 use add_active_range() and free_area_init_nodes

In reply to Andrew Morton
Quoted 9 lines · Andrew Morton
Quoted 3 lines · Mel Gorman

Size zones and holes in an architecture independent manner for ia64.

This one makes my ia64 die very early in boot. The trace is pretty useless.

config at http://www.zip.com.au/~akpm/linux/patches/stuff/config-ia64

An indirect fix for this has been set out with a patchset with the subject "[PATCH 0/2] Fixes for node alignment and flatmem assumptions" . For arch-independent-zone-sizing, the issue was that FLATMEM assumes that NODE_DATA(0)->node_start_pfn == 0. This is not the case with arch-independent-zone-sizing and IA64. With arch-independent-zone-sizing, a nodes node_start_pfn will be at the first valid PFN.

Quoted 4 lines

<log snipped>

Note the misaligned pfns.

You will still get the message about misaligned PFNs on IA64. This is because the lowest zone starts at the lowest available PFN which may not be 0 or any other aligned number. It shouldn't make a different - or at least I couldn't cause any problems.

Signature · 9 lines
Mel Gorman
Part-time Phd Student                          Linux Technology Center
University of Limerick                         IBM Dublin Software Lab

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
#29 lore raw

Re: [PATCH 5/6] Have ia64 use add_active_range() and free_area_init_nodes

Quoted 24 lines · Mel Gorman
Quoted 11 lines · Andrew Morton
Quoted 3 lines · Mel Gorman

Size zones and holes in an architecture independent manner for ia64.

This one makes my ia64 die very early in boot. The trace is pretty
useless.

config at http://www.zip.com.au/~akpm/linux/patches/stuff/config-ia64

An indirect fix for this has been set out with a patchset with the subject "[PATCH 0/2] Fixes for node alignment and flatmem assumptions" . For arch-independent-zone-sizing, the issue was that FLATMEM assumes that NODE_DATA(0)->node_start_pfn == 0. This is not the case with arch-independent-zone-sizing and IA64. With arch-independent-zone-sizing, a nodes node_start_pfn will be at the first valid PFN.

Quoted 2 lines

<log snipped>

Quoted 7 lines
Quoted 2 lines

Note the misaligned pfns.

You will still get the message about misaligned PFNs on IA64. This is because the lowest zone starts at the lowest available PFN which may not be 0 or any other aligned number. It shouldn't make a different - or at least I couldn't cause any problems.

With the updates I sent out to the zone alignment checks yesterday this should now be ignored correctly without comment. The first zone is allowed to be misaligned because we expect alignment of the mem_map. With bob picco's patch from your set we ensure it is so.

-apw

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#5 lore raw

Re: [PATCH 4/6] Have x86_64 use add_active_range() and free_area_init_nodes

In reply to Mel Gorman
Quoted 5 lines · Mel Gorman

Size zones and holes in an architecture independent manner for x86_64.

I found a .config which triggers the cant-map-acpitables problem.

With that .config, and without this patch:

Linux version 2.6.17-rc4-mm2 (akpm@box) (gcc version 4.1.0 20060304 (Red Hat 4.6 BIOS-provided physical RAM map:
BIOS-e820: 0000000000000000 - 000000000009fc00 (usable)
BIOS-e820: 000000000009fc00 - 00000000000a0000 (reserved)
BIOS-e820: 00000000000e0000 - 0000000000100000 (reserved)
BIOS-e820: 0000000000100000 - 00000000ca605000 (usable)
BIOS-e820: 00000000ca605000 - 00000000ca680000 (ACPI NVS)
BIOS-e820: 00000000ca680000 - 00000000cb5ef000 (usable)
BIOS-e820: 00000000cb5ef000 - 00000000cb5fc000 (reserved)
BIOS-e820: 00000000cb5fc000 - 00000000cb6a2000 (usable)
BIOS-e820: 00000000cb6a2000 - 00000000cb6eb000 (ACPI NVS)
BIOS-e820: 00000000cb6eb000 - 00000000cb6ef000 (usable)
BIOS-e820: 00000000cb6ef000 - 00000000cb6ff000 (ACPI data)
BIOS-e820: 00000000cb6ff000 - 00000000cb700000 (usable)
BIOS-e820: 00000000cb700000 - 00000000cc000000 (reserved)
BIOS-e820: 00000000ffe00000 - 0000000100000000 (reserved)
BIOS-e820: 0000000100000000 - 0000000130000000 (usable)
DMI 2.4 present.
ACPI: PM-Timer IO Port: 0x408
ACPI: LAPIC (acpi_id[0x01] lapic_id[0x00] enabled)
Processor #0 6:15 APIC version 20
ACPI: LAPIC (acpi_id[0x02] lapic_id[0x01] enabled)
Processor #1 6:15 APIC version 20
ACPI: LAPIC (acpi_id[0x03] lapic_id[0x82] disabled)
ACPI: LAPIC (acpi_id[0x04] lapic_id[0x83] disabled)
ACPI: LAPIC_NMI (acpi_id[0x01] dfl dfl lint[0x1])
ACPI: LAPIC_NMI (acpi_id[0x02] dfl dfl lint[0x1])
ACPI: IOAPIC (id[0x02] address[0xfec00000] gsi_base[0])
IOAPIC[0]: apic_id 2, version 32, address 0xfec00000, GSI 0-23
ACPI: INT_SRC_OVR (bus 0 bus_irq 0 global_irq 2 dfl dfl)

With that .config, and with this patch:

Bootdata ok (command line is ro root=LABEL=/ earlyprintk=serial,ttyS0,9600,keep [email protected]/eth0,[email protected]/00:0D:56:C6:C6:CC) Linux version 2.6.17-rc4-mm2 (akpm@box) (gcc version 4.1.0 20060304 (Red Hat 4.1.0-3)) #33 SMP Sat May 20 12:08:03 PDT 2006 BIOS-provided physical RAM map:
BIOS-e820: 0000000000000000 - 000000000009fc00 (usable)
BIOS-e820: 000000000009fc00 - 00000000000a0000 (reserved)
BIOS-e820: 00000000000e0000 - 0000000000100000 (reserved)
BIOS-e820: 0000000000100000 - 00000000ca605000 (usable)
BIOS-e820: 00000000ca605000 - 00000000ca680000 (ACPI NVS)
BIOS-e820: 00000000ca680000 - 00000000cb5ef000 (usable)
BIOS-e820: 00000000cb5ef000 - 00000000cb5fc000 (reserved)
BIOS-e820: 00000000cb5fc000 - 00000000cb6a2000 (usable)
BIOS-e820: 00000000cb6a2000 - 00000000cb6eb000 (ACPI NVS)
BIOS-e820: 00000000cb6eb000 - 00000000cb6ef000 (usable)
BIOS-e820: 00000000cb6ef000 - 00000000cb6ff000 (ACPI data)
BIOS-e820: 00000000cb6ff000 - 00000000cb700000 (usable)
BIOS-e820: 00000000cb700000 - 00000000cc000000 (reserved)
BIOS-e820: 00000000ffe00000 - 0000000100000000 (reserved)
BIOS-e820: 0000000100000000 - 0000000130000000 (usable)
Too many memory regions, truncating
Too many memory regions, truncating
Too many memory regions, truncating
DMI 2.4 present.
ACPI: Unable to map RSDT header
Intel MultiProcessor Specification v1.4
Virtual Wire compatibility mode.
OEM ID: Product ID: APIC at: 0xFEE00000

ACPI disables itself.

Good .config: http://www.zip.com.au/~akpm/linux/patches/stuff/config-good
Bad .config: http://www.zip.com.au/~akpm/linux/patches/stuff/config-bad

The handling of MAX_ACTIVE_REGIONS is unpleasing, sorry. In my setup it is
5. But we _really_ only support 4 regions. So for a start it is misnamed. The maximum number of regions we support is actually MAX_ACTIVE_REGIONS-1. And this is a config option too! So the user must specify CONFIG_MAX_ACTIVE_REGIONS as the number of active regions plus one, for the terminating region which has end_pfn=0. It's weird.

I would not consider this code to be adequately commented. Please raise a patch which comments the major functions - what they do, why they do it, any caveats or implementations details. A few lines each - don't overdo it. Details such as whether the various end_pfn's are inclusive or exclusive are important, as is a description of the return value.

Anyway, I just don't get how this code can work. We have an e820 map with up to 128 entries (this machine has ten) and we're trying to scrunch that all into the four-entry early_node_map[].

With config-good we're set up for NUMA, CONFIG_NODES_SHIFT=6. So MAX_ACTIVE_REGIONS is enormous. But it's quite wrong that we're using number-of-zones*number-of-nodes to size a data structure which has to accommodate all the entries in the e820 map. These things aren't related.

On my little x86 PC:

BIOS-provided physical RAM map:
BIOS-e820: 0000000000000000 - 000000000009bc00 (usable)
BIOS-e820: 000000000009bc00 - 000000000009c000 (reserved)
BIOS-e820: 00000000000e0000 - 0000000000100000 (reserved)
BIOS-e820: 0000000000100000 - 000000000ffc0000 (usable)
BIOS-e820: 000000000ffc0000 - 000000000fff8000 (ACPI data)
BIOS-e820: 000000000fff8000 - 0000000010000000 (ACPI NVS)
BIOS-e820: 00000000fec00000 - 00000000fec01000 (reserved)
BIOS-e820: 00000000fee00000 - 00000000fee01000 (reserved)
BIOS-e820: 00000000ffb80000 - 00000000ffc00000 (reserved)
BIOS-e820: 00000000fff00000 - 0000000100000000 (reserved)
0MB HIGHMEM available.
255MB LOWMEM available.
found SMP MP-table at 000ff780
Range (nid 0) 0 -> 65472, max 4
On node 0 totalpages: 65472
DMA zone: 4096 pages, LIFO batch:0
Normal zone: 61376 pages, LIFO batch:15

So here, the architecture code only called add_active_range() the once, for the entire memory map. But on the x86_64 add_active_range() was called once per e820 entry. I'm dimly starting to realise that this is perhaps the problem - the weird-looking definition of MAX_ACTIVE_REGIONS _expects_ the architecture to call add_active_range() with a start_pfn/end_pfn which describes the entire range of pfns for each zone in each node. Even if that span includes not-present pfns. Would that be correct? I didn't see a comment in there describing this design (I do go on).

If so, perhaps the bug is that the x86_64 code isn't doing that. And that x86 isn't doing it for some people either.

Anyway. From the implementation I can see what the code is doing. But I see no description of what it is _supposed_ to be doing. (The process of finding differences between these two things is known as "debugging"). I could kludge things by setting MAX_ACTIVE_REGIONS to 1000000, but enough. I look forward to the next version ;)

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#6 lore raw

Re: [PATCH 4/6] Have x86_64 use add_active_range() and free_area_init_nodes

Quoted 5 lines

Anyway. From the implementation I can see what the code is doing. But I see no description of what it is _supposed_ to be doing. (The process of finding differences between these two things is known as "debugging"). I could kludge things by setting MAX_ACTIVE_REGIONS to 1000000, but enough. I look forward to the next version ;)

Or we could just keep the working old code.

Can somebody remind me what this patch kit was supposed to fix or improve again?

-Andi

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#7 lore raw

Re: [PATCH 4/6] Have x86_64 use add_active_range() and free_area_init_nodes

Quoted 8 lines · Andi Kleen
Quoted 7 lines

Anyway. From the implementation I can see what the code is doing. But I see no description of what it is _supposed_ to be doing. (The process of finding differences between these two things is known as "debugging"). I could kludge things by setting MAX_ACTIVE_REGIONS to 1000000, but enough. I look forward to the next version ;)

Quoted 4 lines

Or we could just keep the working old code.

Can somebody remind me what this patch kit was supposed to fix or improve again?

Well, it creates arch-neutral common code, teaches various architectures use it. It's the sort of thing we do all the time.

These things are opportunities to eliminate crufty arch code which few people understand and replace them with new, clean common code which lots of people understand. That's not a bad thing to be doing.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#8 lore raw

Re: [PATCH 4/6] Have x86_64 use add_active_range() and free_area_init_nodes

Quoted 7 lines

Well, it creates arch-neutral common code, teaches various architectures use it. It's the sort of thing we do all the time.

These things are opportunities to eliminate crufty arch code which few people understand and replace them with new, clean common code which lots of people understand. That's not a bad thing to be doing.

I'm not fundamentally against that, but so far it seems to just generate lots of new bugs? I'm not sure it's really worth the pain.

-Andi

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#9 lore raw

Re: [PATCH 4/6] Have x86_64 use add_active_range() and free_area_init_nodes

Quoted 5 lines · Andi Kleen
Quoted 5 lines

Well, it creates arch-neutral common code, teaches various architectures use it. It's the sort of thing we do all the time.

Quoted 7 lines
Quoted 3 lines

These things are opportunities to eliminate crufty arch code which few people understand and replace them with new, clean common code which lots of people understand. That's not a bad thing to be doing.

I'm not fundamentally against that, but so far it seems to just generate lots of new bugs? I'm not sure it's really worth the pain.

It is a bit disproportionate. But in some ways that's a commentary on the
current code. All this numa/sparse/flat/discontig/holes-in-zones/
virt-memmap/ stuff is pretty hairy, especially in its initalisation.

I'm willing to go through the pain if it ends up with something cleaner which more people understand a little bit.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

author
#11 lore raw

Re: [PATCH 4/6] Have x86_64 use add_active_range() and free_area_init_nodes

In reply to Andrew Morton
Quoted 73 lines · Andrew Morton
Quoted 5 lines · Mel Gorman

Size zones and holes in an architecture independent manner for x86_64.

I found a .config which triggers the cant-map-acpitables problem.

With that .config, and without this patch:

Linux version 2.6.17-rc4-mm2 (akpm@box) (gcc version 4.1.0 20060304 (Red Hat 4.6 BIOS-provided physical RAM map:
BIOS-e820: 0000000000000000 - 000000000009fc00 (usable)
BIOS-e820: 000000000009fc00 - 00000000000a0000 (reserved)
BIOS-e820: 00000000000e0000 - 0000000000100000 (reserved)
BIOS-e820: 0000000000100000 - 00000000ca605000 (usable)
BIOS-e820: 00000000ca605000 - 00000000ca680000 (ACPI NVS)
BIOS-e820: 00000000ca680000 - 00000000cb5ef000 (usable)
BIOS-e820: 00000000cb5ef000 - 00000000cb5fc000 (reserved)
BIOS-e820: 00000000cb5fc000 - 00000000cb6a2000 (usable)
BIOS-e820: 00000000cb6a2000 - 00000000cb6eb000 (ACPI NVS)
BIOS-e820: 00000000cb6eb000 - 00000000cb6ef000 (usable)
BIOS-e820: 00000000cb6ef000 - 00000000cb6ff000 (ACPI data)
BIOS-e820: 00000000cb6ff000 - 00000000cb700000 (usable)
BIOS-e820: 00000000cb700000 - 00000000cc000000 (reserved)
BIOS-e820: 00000000ffe00000 - 0000000100000000 (reserved)
BIOS-e820: 0000000100000000 - 0000000130000000 (usable)
DMI 2.4 present.
ACPI: PM-Timer IO Port: 0x408
ACPI: LAPIC (acpi_id[0x01] lapic_id[0x00] enabled)
Processor #0 6:15 APIC version 20
ACPI: LAPIC (acpi_id[0x02] lapic_id[0x01] enabled)
Processor #1 6:15 APIC version 20
ACPI: LAPIC (acpi_id[0x03] lapic_id[0x82] disabled)
ACPI: LAPIC (acpi_id[0x04] lapic_id[0x83] disabled)
ACPI: LAPIC_NMI (acpi_id[0x01] dfl dfl lint[0x1])
ACPI: LAPIC_NMI (acpi_id[0x02] dfl dfl lint[0x1])
ACPI: IOAPIC (id[0x02] address[0xfec00000] gsi_base[0])
IOAPIC[0]: apic_id 2, version 32, address 0xfec00000, GSI 0-23
ACPI: INT_SRC_OVR (bus 0 bus_irq 0 global_irq 2 dfl dfl)

With that .config, and with this patch:

Bootdata ok (command line is ro root=LABEL=/ earlyprintk=serial,ttyS0,9600,keep [email protected]/eth0,[email protected]/00:0D:56:C6:C6:CC) Linux version 2.6.17-rc4-mm2 (akpm@box) (gcc version 4.1.0 20060304 (Red Hat 4.1.0-3)) #33 SMP Sat May 20 12:08:03 PDT 2006 BIOS-provided physical RAM map:
BIOS-e820: 0000000000000000 - 000000000009fc00 (usable)
BIOS-e820: 000000000009fc00 - 00000000000a0000 (reserved)
BIOS-e820: 00000000000e0000 - 0000000000100000 (reserved)
BIOS-e820: 0000000000100000 - 00000000ca605000 (usable)
BIOS-e820: 00000000ca605000 - 00000000ca680000 (ACPI NVS)
BIOS-e820: 00000000ca680000 - 00000000cb5ef000 (usable)
BIOS-e820: 00000000cb5ef000 - 00000000cb5fc000 (reserved)
BIOS-e820: 00000000cb5fc000 - 00000000cb6a2000 (usable)
BIOS-e820: 00000000cb6a2000 - 00000000cb6eb000 (ACPI NVS)
BIOS-e820: 00000000cb6eb000 - 00000000cb6ef000 (usable)
BIOS-e820: 00000000cb6ef000 - 00000000cb6ff000 (ACPI data)
BIOS-e820: 00000000cb6ff000 - 00000000cb700000 (usable)
BIOS-e820: 00000000cb700000 - 00000000cc000000 (reserved)
BIOS-e820: 00000000ffe00000 - 0000000100000000 (reserved)
BIOS-e820: 0000000100000000 - 0000000130000000 (usable)
Too many memory regions, truncating
Too many memory regions, truncating
Too many memory regions, truncating
DMI 2.4 present.
ACPI: Unable to map RSDT header
Intel MultiProcessor Specification v1.4
Virtual Wire compatibility mode.
OEM ID: Product ID: APIC at: 0xFEE00000

Quoted 2 lines

ACPI disables itself.

ok, not good but at least it's certain. I had been lulled into a false sense of security when Christian's machine was still not able to boot with the patch backed out. I still have not reproduced the problem locally, but I don't have an x86_64 with so many holes either.

Quoted 11 lines

Good .config: http://www.zip.com.au/~akpm/linux/patches/stuff/config-good
Bad .config: http://www.zip.com.au/~akpm/linux/patches/stuff/config-bad

The handling of MAX_ACTIVE_REGIONS is unpleasing, sorry. In my setup it is
5. But we _really_ only support 4 regions. So for a start it is misnamed. The maximum number of regions we support is actually MAX_ACTIVE_REGIONS-1. And this is a config option too! So the user must specify CONFIG_MAX_ACTIVE_REGIONS as the number of active regions plus one, for the terminating region which has end_pfn=0. It's weird.

That's a fair comment. I'll put more thought into the definition of MAX_ACTIVE_REGIONS and how it is used.

Quoted 6 lines

I would not consider this code to be adequately commented. Please raise a patch which comments the major functions - what they do, why they do it, any caveats or implementations details. A few lines each - don't overdo it. Details such as whether the various end_pfn's are inclusive or exclusive are important, as is a description of the return value.

Understood. Right now, the closest thing to an explanation is a comment in include/linux/mm.h but it is not very detailed.

Quoted 4 lines

Anyway, I just don't get how this code can work. We have an e820 map with up to 128 entries (this machine has ten) and we're trying to scrunch that all into the four-entry early_node_map[].

Missing E820MAX was a mistake. On x86_64, CONFIG_MAX_ACTIVE_REGIONS should have been used. I didn't expect x86_64 to have so many memory holes.

Quoted 5 lines

With config-good we're set up for NUMA, CONFIG_NODES_SHIFT=6. So MAX_ACTIVE_REGIONS is enormous. But it's quite wrong that we're using number-of-zones*number-of-nodes to size a data structure which has to accommodate all the entries in the e820 map. These things aren't related.

Very true.

Quoted 22 lines

On my little x86 PC:

BIOS-provided physical RAM map:
BIOS-e820: 0000000000000000 - 000000000009bc00 (usable)
BIOS-e820: 000000000009bc00 - 000000000009c000 (reserved)
BIOS-e820: 00000000000e0000 - 0000000000100000 (reserved)
BIOS-e820: 0000000000100000 - 000000000ffc0000 (usable)
BIOS-e820: 000000000ffc0000 - 000000000fff8000 (ACPI data)
BIOS-e820: 000000000fff8000 - 0000000010000000 (ACPI NVS)
BIOS-e820: 00000000fec00000 - 00000000fec01000 (reserved)
BIOS-e820: 00000000fee00000 - 00000000fee01000 (reserved)
BIOS-e820: 00000000ffb80000 - 00000000ffc00000 (reserved)
BIOS-e820: 00000000fff00000 - 0000000100000000 (reserved) 0MB HIGHMEM available.
255MB LOWMEM available.
found SMP MP-table at 000ff780
Range (nid 0) 0 -> 65472, max 4
On node 0 totalpages: 65472
DMA zone: 4096 pages, LIFO batch:0
Normal zone: 61376 pages, LIFO batch:15

Quoted 2 lines

So here, the architecture code only called add_active_range() the once, for the entire memory map.

Because in this case, the architecture reported that there was just one range of available pages with no holes.

Quoted 1 line

But on the x86_64 add_active_range() was called once per e820 entry. I'm dimly starting to realise that this is perhaps the problem - the weird-looking definition of MAX_ACTIVE_REGIONS _expects_ the architecture to call add_active_range() with a start_pfn/end_pfn which describes the entire range of pfns for each zone in each node. Even if that span includes not-present pfns. Would that be correct?

Not quite and the confusion is because of how I defined MAX_ACTIVE_REGIONS. The calculation for it is similar to how i386 using SRAT calculates MAX_CHUNKS;

#define MAX_CHUNKS_PER_NODE 4
#define MAXCHUNKS (MAX_CHUNKS_PER_NODE * MAX_NUMNODES)

which has little bearing on any other arch.

What is meant to happen is that add_active_range() is called for every range of physical page frames where real memory is, regardless of what zone they are in. On x86_64, the ranges are discovered by walking the e820 map in e820_register_active_ranges(). Once it is known where physical memory is, the holes can be figured out. If I have;

Range (nid 0) 0 -> 100
Range (nid 0) 200 -> 400

I know there is a memory hole of 100 pages. The end PFN of each zone is passed to free_area_init_nodes(). By walking the early_node_map[], it can be discovered what the size of the zone and the holes are.

Quoted 3 lines

I didn't see
a comment in there describing this design (I do go on).

I'll address that issue.

Quoted 3 lines

If so, perhaps the bug is that the x86_64 code isn't doing that. And that x86 isn't doing it for some people either.

I'm hoping in this case that having MAX_ACTIVE_REGIONS match E820MAX will fix the issue on your machine. I'm still confused why Christian's failed to boot with the patch backed out though.

Quoted 6 lines

Anyway. From the implementation I can see what the code is doing. But I see no description of what it is _supposed_ to be doing. (The process of finding differences between these two things is known as "debugging"). I could kludge things by setting MAX_ACTIVE_REGIONS to 1000000, but enough. I look forward to the next version ;)

I'll start working on it. Thanks a lot.

Signature · 9 lines
Mel Gorman
Part-time Phd Student                          Linux Technology Center
University of Limerick                         IBM Dublin Software Lab

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
author
#10 lore raw

Re: [PATCH 4/6] Have x86_64 use add_active_range() and free_area_init_nodes

In reply to Andi Kleen
Quoted 11 lines · Andi Kleen
Quoted 6 lines

Anyway. From the implementation I can see what the code is doing. But I see no description of what it is _supposed_ to be doing. (The process of finding differences between these two things is known as "debugging"). I could kludge things by setting MAX_ACTIVE_REGIONS to 1000000, but enough. I look forward to the next version ;)

Or we could just keep the working old code.

Can somebody remind me what this patch kit was supposed to fix or improve again?

The current code for discovering the zone sizes and holes is sometimes very hairy despite there being some similaries in each arch. This patch kit will eliminiate some of the uglier code and have one place where zones and holes can be sized. To me, that is a good idea once the bugs are rattled out.

On a related note, parts of the current zone-based anti-fragmentation implementation are an architecture-specific mess because changing how zones are sized is tricky with the current code. With this patch kit, sizing zones for easily reclaimable pages is relatively straight-forward.

Signature · 9 lines
Mel Gorman
Part-time Phd Student                          Linux Technology Center
University of Limerick                         IBM Dublin Software Lab

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
#12 lore raw

Re: [PATCH 4/6] Have x86_64 use add_active_range() and free_area_init_nodes

In reply to Mel Gorman
Quoted 9 lines · Mel Gorman
Quoted 6 lines

Anyway, I just don't get how this code can work. We have an e820 map with up to 128 entries (this machine has ten) and we're trying to scrunch that all into the four-entry early_node_map[].

Missing E820MAX was a mistake. On x86_64, CONFIG_MAX_ACTIVE_REGIONS should have been used. I didn't expect x86_64 to have so many memory holes.

x86 uses 128 e820 slots too.

Quoted 22 lines
Quoted 22 lines

On my little x86 PC:

BIOS-provided physical RAM map:
BIOS-e820: 0000000000000000 - 000000000009bc00 (usable)
BIOS-e820: 000000000009bc00 - 000000000009c000 (reserved)
BIOS-e820: 00000000000e0000 - 0000000000100000 (reserved)
BIOS-e820: 0000000000100000 - 000000000ffc0000 (usable)
BIOS-e820: 000000000ffc0000 - 000000000fff8000 (ACPI data)
BIOS-e820: 000000000fff8000 - 0000000010000000 (ACPI NVS)
BIOS-e820: 00000000fec00000 - 00000000fec01000 (reserved)
BIOS-e820: 00000000fee00000 - 00000000fee01000 (reserved)
BIOS-e820: 00000000ffb80000 - 00000000ffc00000 (reserved)
BIOS-e820: 00000000fff00000 - 0000000100000000 (reserved) 0MB HIGHMEM available.
255MB LOWMEM available.
found SMP MP-table at 000ff780
Range (nid 0) 0 -> 65472, max 4
On node 0 totalpages: 65472
DMA zone: 4096 pages, LIFO batch:0
Normal zone: 61376 pages, LIFO batch:15

Quoted 5 lines
Quoted 2 lines

So here, the architecture code only called add_active_range() the once, for the entire memory map.

Because in this case, the architecture reported that there was just one range of available pages with no holes.

So.. we're registering a simgle blob of pfns which includes the "reserved" memory as well as the "ACPI data" and the "ACPI NVS" (with an apparent off-by-one here).

How come the machine still works? I guess the architecture went and marked those pfns reserved.

Quoted 6 lines
Quoted 3 lines

If so, perhaps the bug is that the x86_64 code isn't doing that. And that x86 isn't doing it for some people either.

I'm hoping in this case that having MAX_ACTIVE_REGIONS match E820MAX will fix the issue on your machine.

I expect it will.

One does wonder whether it's worth all this fuss though. It's only a 24-byte structure and it's all thrown away in free_initmem(). One _could_ just go and do

	#define MAX_ACTIVE_REGIONS 10000

and be happy.

Quoted 2 lines

I'm still confused why Christian's failed
to boot with the patch backed out though.

He didn't get any "Too many memory regions" messages, so it's something different.

Maybe he hit my off-by-one on his "ACPI data"?

hm, I didn't mention this in the earlier email. On my x86 I have

BIOS-provided physical RAM map:
BIOS-e820: 0000000000000000 - 000000000009bc00 (usable)
BIOS-e820: 000000000009bc00 - 000000000009c000 (reserved)
BIOS-e820: 00000000000e0000 - 0000000000100000 (reserved)
BIOS-e820: 0000000000100000 - 000000000ffc0000 (usable)
BIOS-e820: 000000000ffc0000 - 000000000fff8000 (ACPI data)
BIOS-e820: 000000000fff8000 - 0000000010000000 (ACPI NVS)
BIOS-e820: 00000000fec00000 - 00000000fec01000 (reserved)
BIOS-e820: 00000000fee00000 - 00000000fee01000 (reserved)
BIOS-e820: 00000000ffb80000 - 00000000ffc00000 (reserved)
BIOS-e820: 00000000fff00000 - 0000000100000000 (reserved)

I added some debug and saw that add_active_range() was getting a start_pfn=0 and an end_pfn which corresponds with 0x0fffc000. So my "ACPI NVS" is getting chopped off.

If Christian is seeing a similar thing then his "ACPI data" will be getting only part-registered.

I'd suggest that the next rev be liberal in its printking. This is the debug patch I used:

 mm/page_alloc.c |   25 +++++++++++++++++++++----
 1 file changed, 21 insertions(+), 4 deletions(-)
mm/page_alloc.c renamed from mm/page_alloc.c~a +21 -4
diff -puN mm/page_alloc.c~a mm/page_alloc.c
@@ -2463,22 +2463,36 @@ void __init add_active_range(unsigned in
 						unsigned long end_pfn)
 {
 	unsigned int i;
-	printk(KERN_DEBUG "Range (%d) %lu -> %lu\n", nid, start_pfn, end_pfn);
+
+	printk("Range (nid %d) %lu -> %lu, max %d\n",
+			nid, start_pfn, end_pfn, MAX_ACTIVE_REGIONS - 1);
 
 	/* Merge with existing active regions if possible */
 	for (i = 0; early_node_map[i].end_pfn; i++) {
-		if (early_node_map[i].nid != nid)
+		printk("i=%d early_node_map[i].nid=%d "
+				"early_node_map[i].start_pfn=%lu "
+				"early_node_map[i].end_pfn=%lu",
+			i, early_node_map[i].nid,
+			early_node_map[i].start_pfn,
+			early_node_map[i].end_pfn);
+
+		if (early_node_map[i].nid != nid) {
+			printk(" continue 1\n");
 			continue;
+		}
 
 		/* Skip if an existing region covers this new one */
 		if (start_pfn >= early_node_map[i].start_pfn &&
-				end_pfn <= early_node_map[i].end_pfn)
+				end_pfn <= early_node_map[i].end_pfn) {
+			printk(" return 1\n");
 			return;
+		}
 
 		/* Merge forward if suitable */
 		if (start_pfn <= early_node_map[i].end_pfn &&
 				end_pfn > early_node_map[i].end_pfn) {
 			early_node_map[i].end_pfn = end_pfn;
+			printk(" return 2\n");
 			return;
 		}
 
@@ -2486,13 +2500,16 @@ void __init add_active_range(unsigned in
 		if (start_pfn < early_node_map[i].end_pfn &&
 				end_pfn >= early_node_map[i].start_pfn) {
 			early_node_map[i].start_pfn = start_pfn;
+			printk(" return 3\n");
 			return;
 		}
+		printk("\n");
 	}
 
 	/* Leave last entry NULL, we use range.end_pfn to terminate the walk */
 	if (i >= MAX_ACTIVE_REGIONS - 1) {
-		printk(KERN_ERR "Too many memory regions, truncating\n");
+		printk(KERN_ERR "More than %d memory regions, truncating\n",
+				MAX_ACTIVE_REGIONS - 1);
 		return;
 	}
 

_

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

author
#13 lore raw

Re: [PATCH 4/6] Have x86_64 use add_active_range() and free_area_init_nodes

Quoted 8 lines · Andrew Morton
Quoted 7 lines · Mel Gorman
Quoted 6 lines

Anyway, I just don't get how this code can work. We have an e820 map with up to 128 entries (this machine has ten) and we're trying to scrunch that all into the four-entry early_node_map[].

Quoted 5 lines
Quoted 2 lines

Missing E820MAX was a mistake. On x86_64, CONFIG_MAX_ACTIVE_REGIONS should have been used. I didn't expect x86_64 to have so many memory holes.

x86 uses 128 e820 slots too.

That is true, but with x86, I am not expecting many regions. For flatmem, only one region will be registered. For NUMA, I would expect one registration per node *unless* SRAT is being used. With SRAT, MAXCHUNKS regions at most with is 4 * MAX_NUMNODES.

Quoted 25 lines
Quoted 25 lines
Quoted 24 lines

On my little x86 PC:

BIOS-provided physical RAM map:
BIOS-e820: 0000000000000000 - 000000000009bc00 (usable)
BIOS-e820: 000000000009bc00 - 000000000009c000 (reserved)
BIOS-e820: 00000000000e0000 - 0000000000100000 (reserved)
BIOS-e820: 0000000000100000 - 000000000ffc0000 (usable)
BIOS-e820: 000000000ffc0000 - 000000000fff8000 (ACPI data)
BIOS-e820: 000000000fff8000 - 0000000010000000 (ACPI NVS)
BIOS-e820: 00000000fec00000 - 00000000fec01000 (reserved)
BIOS-e820: 00000000fee00000 - 00000000fee01000 (reserved)
BIOS-e820: 00000000ffb80000 - 00000000ffc00000 (reserved)
BIOS-e820: 00000000fff00000 - 0000000100000000 (reserved) 0MB HIGHMEM available.
255MB LOWMEM available.
found SMP MP-table at 000ff780
Range (nid 0) 0 -> 65472, max 4
On node 0 totalpages: 65472
DMA zone: 4096 pages, LIFO batch:0
Normal zone: 61376 pages, LIFO batch:15

So here, the architecture code only called add_active_range() the once, for the entire memory map.

Quoted 7 lines
Quoted 2 lines

Because in this case, the architecture reported that there was just one range of available pages with no holes.

So.. we're registering a simgle blob of pfns which includes the "reserved" memory as well as the "ACPI data" and the "ACPI NVS" (with an apparent off-by-one here).

The off-by-one is a surprise. On this machine, it must be because the arch-specific code calculated highend_pfn wrong. I don't use the e820 on i386 because it didn't seem necessary.

Quoted 3 lines

How come the machine still works? I guess the architecture went and marked those pfns reserved.

Yes, that is what I'd expect to happen. The ranges are registered and a memmap allocated but the freeing of memory from bootmem is still the same on i386. For i386, my patchset reports the same size of zones and start_pfn on each node so there should be no difference in the end result between my code and the arch-specific initialisation.

Quoted 9 lines
Quoted 6 lines
Quoted 3 lines

If so, perhaps the bug is that the x86_64 code isn't doing that. And that x86 isn't doing it for some people either.

I'm hoping in this case that having MAX_ACTIVE_REGIONS match E820MAX will fix the issue on your machine.

I expect it will.

Quoted 8 lines

One does wonder whether it's worth all this fuss though. It's only a 24-byte structure and it's all thrown away in free_initmem(). One _could_ just go and do

	#define MAX_ACTIVE_REGIONS 10000

and be happy.

I could, but I thought I'd be shot for trying something like that. A fixed value of 128 would cover the largest tables I'm aware of on all architectures. Should I just set that fixed value?

Quoted 8 lines
Quoted 2 lines

I'm still confused why Christian's failed
to boot with the patch backed out though.

He didn't get any "Too many memory regions" messages, so it's something different.

Maybe he hit my off-by-one on his "ACPI data"?

Possibly but the off-by-one error for you was on x86 not x86_64 and I suspect that highend_pfn was wrong in this case. I'll be checking tomorrow where I can see an off-by-one error.

Quoted 14 lines

hm, I didn't mention this in the earlier email. On my x86 I have

BIOS-provided physical RAM map:
BIOS-e820: 0000000000000000 - 000000000009bc00 (usable)
BIOS-e820: 000000000009bc00 - 000000000009c000 (reserved)
BIOS-e820: 00000000000e0000 - 0000000000100000 (reserved)
BIOS-e820: 0000000000100000 - 000000000ffc0000 (usable)
BIOS-e820: 000000000ffc0000 - 000000000fff8000 (ACPI data)
BIOS-e820: 000000000fff8000 - 0000000010000000 (ACPI NVS)
BIOS-e820: 00000000fec00000 - 00000000fec01000 (reserved)
BIOS-e820: 00000000fee00000 - 00000000fee01000 (reserved)
BIOS-e820: 00000000ffb80000 - 00000000ffc00000 (reserved)
BIOS-e820: 00000000fff00000 - 0000000100000000 (reserved)

Quoted 4 lines

I added some debug and saw that add_active_range() was getting a start_pfn=0 and an end_pfn which corresponds with 0x0fffc000. So my "ACPI NVS" is getting chopped off.

Yes. However, this just means that the memory for that the PFN range will not be backed by memmap. This would only be a problem if free_bootmem() is called on those range of pages. If that was happening, I would be expecting oops early or bad_page reports during the boot process.

Quoted 6 lines

If Christian is seeing a similar thing then his "ACPI data" will be getting only part-registered.

I'd suggest that the next rev be liberal in its printking. This is the debug patch I used:

I also have an old debug patch that was very printk happy. I will dust it off and add it with the additional information from your patch.

Quoted 66 lines

mm/page_alloc.c | 25 +++++++++++++++++++++----

1 file changed, 21 insertions(+), 4 deletions(-)

diff -puN mm/page_alloc.c~a mm/page_alloc.c

mm/page_alloc.c renamed from mm/page_alloc.c~a +21 -4
@@ -2463,22 +2463,36 @@ void __init add_active_range(unsigned in
 						unsigned long end_pfn)
 {
 	unsigned int i;
-	printk(KERN_DEBUG "Range (%d) %lu -> %lu\n", nid, start_pfn, end_pfn);
+
+	printk("Range (nid %d) %lu -> %lu, max %d\n",
+			nid, start_pfn, end_pfn, MAX_ACTIVE_REGIONS - 1);
 
 	/* Merge with existing active regions if possible */
 	for (i = 0; early_node_map[i].end_pfn; i++) {
-		if (early_node_map[i].nid != nid)
+		printk("i=%d early_node_map[i].nid=%d "
+				"early_node_map[i].start_pfn=%lu "
+				"early_node_map[i].end_pfn=%lu",
+			i, early_node_map[i].nid,
+			early_node_map[i].start_pfn,
+			early_node_map[i].end_pfn);
+
+		if (early_node_map[i].nid != nid) {
+			printk(" continue 1\n");
 			continue;
+		}
 
 		/* Skip if an existing region covers this new one */
 		if (start_pfn >= early_node_map[i].start_pfn &&
-				end_pfn <= early_node_map[i].end_pfn)
+				end_pfn <= early_node_map[i].end_pfn) {
+			printk(" return 1\n");
 			return;
+		}
 
 		/* Merge forward if suitable */
 		if (start_pfn <= early_node_map[i].end_pfn &&
 				end_pfn > early_node_map[i].end_pfn) {
 			early_node_map[i].end_pfn = end_pfn;
+			printk(" return 2\n");
 			return;
 		}
 
@@ -2486,13 +2500,16 @@ void __init add_active_range(unsigned in
 		if (start_pfn < early_node_map[i].end_pfn &&
 				end_pfn >= early_node_map[i].start_pfn) {
 			early_node_map[i].start_pfn = start_pfn;
+			printk(" return 3\n");
 			return;
 		}
+		printk("\n");
 	}
 
 	/* Leave last entry NULL, we use range.end_pfn to terminate the walk */
 	if (i >= MAX_ACTIVE_REGIONS - 1) {
-		printk(KERN_ERR "Too many memory regions, truncating\n");
+		printk(KERN_ERR "More than %d memory regions, truncating\n",
+				MAX_ACTIVE_REGIONS - 1);
 		return;
 	}
 

_

Signature · 9 lines
Mel Gorman
Part-time Phd Student                          Linux Technology Center
University of Limerick                         IBM Dublin Software Lab

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
author
#14 lore raw

Re: [PATCH 4/6] Have x86_64 use add_active_range() and free_area_init_nodes

In reply to Andrew Morton
Quoted 64 lines · Andrew Morton
Quoted 5 lines · Mel Gorman

Size zones and holes in an architecture independent manner for x86_64.

I found a .config which triggers the cant-map-acpitables problem.

With that .config, and without this patch:

Linux version 2.6.17-rc4-mm2 (akpm@box) (gcc version 4.1.0 20060304 (Red Hat 4.6 BIOS-provided physical RAM map:
BIOS-e820: 0000000000000000 - 000000000009fc00 (usable)
BIOS-e820: 000000000009fc00 - 00000000000a0000 (reserved)
BIOS-e820: 00000000000e0000 - 0000000000100000 (reserved)
BIOS-e820: 0000000000100000 - 00000000ca605000 (usable)
BIOS-e820: 00000000ca605000 - 00000000ca680000 (ACPI NVS)
BIOS-e820: 00000000ca680000 - 00000000cb5ef000 (usable)
BIOS-e820: 00000000cb5ef000 - 00000000cb5fc000 (reserved)
BIOS-e820: 00000000cb5fc000 - 00000000cb6a2000 (usable)
BIOS-e820: 00000000cb6a2000 - 00000000cb6eb000 (ACPI NVS)
BIOS-e820: 00000000cb6eb000 - 00000000cb6ef000 (usable)
BIOS-e820: 00000000cb6ef000 - 00000000cb6ff000 (ACPI data)
BIOS-e820: 00000000cb6ff000 - 00000000cb700000 (usable)
BIOS-e820: 00000000cb700000 - 00000000cc000000 (reserved)
BIOS-e820: 00000000ffe00000 - 0000000100000000 (reserved)
BIOS-e820: 0000000100000000 - 0000000130000000 (usable)
DMI 2.4 present.
ACPI: PM-Timer IO Port: 0x408
ACPI: LAPIC (acpi_id[0x01] lapic_id[0x00] enabled)
Processor #0 6:15 APIC version 20
ACPI: LAPIC (acpi_id[0x02] lapic_id[0x01] enabled)
Processor #1 6:15 APIC version 20
ACPI: LAPIC (acpi_id[0x03] lapic_id[0x82] disabled)
ACPI: LAPIC (acpi_id[0x04] lapic_id[0x83] disabled)
ACPI: LAPIC_NMI (acpi_id[0x01] dfl dfl lint[0x1])
ACPI: LAPIC_NMI (acpi_id[0x02] dfl dfl lint[0x1])
ACPI: IOAPIC (id[0x02] address[0xfec00000] gsi_base[0])
IOAPIC[0]: apic_id 2, version 32, address 0xfec00000, GSI 0-23
ACPI: INT_SRC_OVR (bus 0 bus_irq 0 global_irq 2 dfl dfl)

With that .config, and with this patch:

Bootdata ok (command line is ro root=LABEL=/ earlyprintk=serial,ttyS0,9600,keep [email protected]/eth0,[email protected]/00:0D:56:C6:C6:CC) Linux version 2.6.17-rc4-mm2 (akpm@box) (gcc version 4.1.0 20060304 (Red Hat 4.1.0-3)) #33 SMP Sat May 20 12:08:03 PDT 2006 BIOS-provided physical RAM map:
BIOS-e820: 0000000000000000 - 000000000009fc00 (usable)
BIOS-e820: 000000000009fc00 - 00000000000a0000 (reserved)
BIOS-e820: 00000000000e0000 - 0000000000100000 (reserved)
BIOS-e820: 0000000000100000 - 00000000ca605000 (usable)
BIOS-e820: 00000000ca605000 - 00000000ca680000 (ACPI NVS)
BIOS-e820: 00000000ca680000 - 00000000cb5ef000 (usable)
BIOS-e820: 00000000cb5ef000 - 00000000cb5fc000 (reserved)
BIOS-e820: 00000000cb5fc000 - 00000000cb6a2000 (usable)
BIOS-e820: 00000000cb6a2000 - 00000000cb6eb000 (ACPI NVS)
BIOS-e820: 00000000cb6eb000 - 00000000cb6ef000 (usable)
BIOS-e820: 00000000cb6ef000 - 00000000cb6ff000 (ACPI data)
BIOS-e820: 00000000cb6ff000 - 00000000cb700000 (usable)
BIOS-e820: 00000000cb700000 - 00000000cc000000 (reserved)
BIOS-e820: 00000000ffe00000 - 0000000100000000 (reserved)
BIOS-e820: 0000000100000000 - 0000000130000000 (usable)

Quoted 9 lines

Too many memory regions, truncating
Too many memory regions, truncating
Too many memory regions, truncating
DMI 2.4 present.
ACPI: Unable to map RSDT header
Intel MultiProcessor Specification v1.4
Virtual Wire compatibility mode.
OEM ID: Product ID: APIC at: 0xFEE00000

I think I have figured out what went wrong here.

arch/i386/kernel/acpi/boot.c has a __acpi_map_table() function which uses a variable end_pfn_map variable defined in arch/x86_64/kernel/e820.c . Part of the arch-independent-zone-sizing patch calculates end_pfn_map from early_node_map[] which only contains information on real RAM regions.

On Christian's machine, there is no usable region after the ACPI table data so early_node_map[] finishes just before the ACPI tables. This results in the wrong value for end_pfn_map and the table fails to be mapped. In Andrew's machines case, the regions got truncated and nothing after ACPI NVS was recorded, including ACPI data which is why it fails to boot.

Am not ready to release another set of patches, but I think this was the cause of magic failures on x86_64.

Signature · 9 lines
Mel Gorman
Part-time Phd Student                          Linux Technology Center
University of Limerick                         IBM Dublin Software Lab

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>