Skip to contentSkip to conversation

add memory present for ppc64

PATCH In review Andy Whitcroft 3 participants 4 messages May 4, 2005 – May 5, 2005 Memory management

lore
Share & tools
lore
#0 lore raw

PATCH 2/3 add memory present for ppc64

Provide hooks for PPC64 to allow memory models to be informed of installed memory areas. This allows SPARSEMEM to instantiate mem_map for the populated areas.

---
 Kconfig   |    4 ++--
 mm/numa.c |    3 +++
 2 files changed, 5 insertions(+), 2 deletions(-)
arch/ppc64/Kconfig +2 -2
diff -X /home/apw/brief/lib/vdiff.excl -rupN reference/arch/ppc64/Kconfig current/arch/ppc64/Kconfig
@@ -212,8 +212,8 @@ config ARCH_FLATMEM_ENABLE
 source "mm/Kconfig"
 
 config HAVE_ARCH_EARLY_PFN_TO_NID
-	bool
-	default y
+	def_bool y
+	depends on NEED_MULTIPLE_NODES
 
 # Some NUMA nodes have memory ranges that span
 # other nodes.  Even though a pfn is valid and
arch/ppc64/mm/numa.c +3 -0
diff -X /home/apw/brief/lib/vdiff.excl -rupN reference/arch/ppc64/mm/numa.c current/arch/ppc64/mm/numa.c
@@ -440,6 +440,8 @@ new_range:
 		for (i = start ; i < (start+size); i += MEMORY_INCREMENT)
 			numa_memory_lookup_table[i >> MEMORY_INCREMENT_SHIFT] =
 				numa_domain;
+		memory_present(numa_domain, start >> PAGE_SHIFT,
+						(start + size) >> PAGE_SHIFT);
 
 		if (--ranges)
 			goto new_range;
@@ -481,6 +483,7 @@ static void __init setup_nonnuma(void)
 
 	for (i = 0 ; i < top_of_ram; i += MEMORY_INCREMENT)
 		numa_memory_lookup_table[i >> MEMORY_INCREMENT_SHIFT] = 0;
+	memory_present(0, 0, init_node_data[0].node_end_pfn);
 }
 
 static void __init dump_numa_topology(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>

#1 lore raw

arch/ppc64/Kconfig config ARCH_FLATMEM_ENABLE · line 216

Quoted 11 lines · Andy Whitcroft

diff -X /home/apw/brief/lib/vdiff.excl -rupN reference/arch/ppc64/Kconfig current/arch/ppc64/Kconfig

arch/ppc64/Kconfig +2 -2
@@ -212,8 +212,8 @@ config ARCH_FLATMEM_ENABLE
 source "mm/Kconfig"
 
 config HAVE_ARCH_EARLY_PFN_TO_NID
-	bool
-	default y
+	def_bool y
+	depends on NEED_MULTIPLE_NODES

Ok, time to show my lack of undestanding here, but when can we ever be CONFIG_NUMA and NOT need multiple nodes?

arch/ppc64/Kconfig static void __init setup_nonnuma(void) · line 486

Quoted 5 lines
arch/ppc64/Kconfig +1 -0
@@ -481,6 +483,7 @@ static void __init setup_nonnuma(void)
 
 	for (i = 0 ; i < top_of_ram; i += MEMORY_INCREMENT)
 		numa_memory_lookup_table[i >> MEMORY_INCREMENT_SHIFT] = 0;
+	memory_present(0, 0, init_node_data[0].node_end_pfn);

Isn't the memory_present stuff and numa_memory_lookup_table two implementations doing the same thing (mapping memory to nodes)? Can we kill numa_memory_lookup_table with this?

-Olof
--
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>

#2 lore raw
Quoted 7 lines · Olof Johansson
Quoted 6 lines · Andy Whitcroft

diff -X /home/apw/brief/lib/vdiff.excl -rupN reference/arch/ppc64/Kconfig current/arch/ppc64/Kconfig

arch/ppc64/Kconfig +0 -0
@@ -212,8 +212,8 @@ config ARCH_FLATMEM_ENABLE
 source "mm/Kconfig"
 
Quoted 8 lines

arch/ppc64/Kconfig config ARCH_FLATMEM_ENABLE · line 216

Quoted 5 lines
arch/ppc64/Kconfig +2 -2
 config HAVE_ARCH_EARLY_PFN_TO_NID
-	bool
-	default y
+	def_bool y
+	depends on NEED_MULTIPLE_NODES

Ok, time to show my lack of undestanding here, but when can we ever be CONFIG_NUMA and NOT need multiple nodes?

NEED_MULTIPLE_NODES is for DISCONTIG || NUMA. It is a blanket config option that helps us separate those two very intertwined options.

Quoted 8 lines

arch/ppc64/Kconfig static void __init setup_nonnuma(void) · line 486

Quoted 5 lines
arch/ppc64/Kconfig +1 -0
@@ -481,6 +483,7 @@ static void __init setup_nonnuma(void)
 
 	for (i = 0 ; i < top_of_ram; i += MEMORY_INCREMENT)
 		numa_memory_lookup_table[i >> MEMORY_INCREMENT_SHIFT] = 0;
+	memory_present(0, 0, init_node_data[0].node_end_pfn);

Isn't the memory_present stuff and numa_memory_lookup_table two implementations doing the same thing (mapping memory to nodes)?

They have similar functions: record the physical layout of the system. But, memory_present() is for sparsemem, which basically implements pfn_to_page() and page_to_pfn().

The numa_memory_lookup_table[] is used for pfn_to_nid(), which is actually orthogonal to what sparsemem needs.

Quoted 1 line

Can we kill numa_memory_lookup_table with this?

Nope, we still need it for pfn_to_nid(). We could possibly replace the current implementation like this:

#define pfn_to_nid(pfn) page_zone(__pfn_to_section(pfn)->section_mem_map[pfn])->zone_pgdat->node_id

But, that might have a few performance implications :) There are certainly some options that sparsemem opens up here, and I hope that we explore them further as we move away from discontig.

We could even do something like store the nid directly in the mem_section. But, as I said, that's an optimization that can come later.

-- Dave

--
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>

#3 lore raw
In reply to Olof Johansson
Quoted 22 lines · Olof Johansson

arch/ppc64/Kconfig config ARCH_FLATMEM_ENABLE · line 216

Quoted 11 lines · Andy Whitcroft

diff -X /home/apw/brief/lib/vdiff.excl -rupN reference/arch/ppc64/Kconfig current/arch/ppc64/Kconfig

arch/ppc64/Kconfig +0 -0
@@ -212,8 +212,8 @@ config ARCH_FLATMEM_ENABLE

source "mm/Kconfig"

config HAVE_ARCH_EARLY_PFN_TO_NID

arch/ppc64/Kconfig +2 -2
-	bool
-	default y
+	def_bool y
+	depends on NEED_MULTIPLE_NODES

Ok, time to show my lack of undestanding here, but when can we ever be CONFIG_NUMA and NOT need multiple nodes?

Quoted 2 lines
arch/ppc64/Kconfig +0 -0
@@ -481,6 +483,7 @@ static void __init setup_nonnuma(void)
 
Quoted 8 lines

arch/ppc64/Kconfig static void __init setup_nonnuma(void) · line 486

Quoted 3 lines
arch/ppc64/Kconfig +1 -0
 	for (i = 0 ; i < top_of_ram; i += MEMORY_INCREMENT)
 		numa_memory_lookup_table[i >> MEMORY_INCREMENT_SHIFT] = 0;
+	memory_present(0, 0, init_node_data[0].node_end_pfn);

Isn't the memory_present stuff and numa_memory_lookup_table two implementations doing the same thing (mapping memory to nodes)? Can we kill numa_memory_lookup_table with this?

This table basically is part of the DISCONTIGMEM implementation and used lightly by SPARSEMEM. In the i386 port we have already pushd that out into a discontigmem implementation of memory_present. That is a logical next step in this port and I've got some of it already done. That should sit nicely on this lot. I'll work on this one.

-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>