[1/4] [RFC] ppc64 discontig pull out numa_memory_lookup init
Andy Whitcroft
apw at shadowen.org
Fri May 20 02:44:23 EST 2005
It seems we have two complete copies of the code which initialises
the numa_memory_lookup_table. Pull this out to a common initialisation
routine in preparation to limiting its use to the DISCONTIGMEM memory
model only.
Signed-off-by: Andy Whitcroft <apw at shadowen.org>
diffstat ppc64-discontig-pull-out-numa_memory_lookup-init
---
diff -upN reference/arch/ppc64/mm/numa.c current/arch/ppc64/mm/numa.c
--- reference/arch/ppc64/mm/numa.c
+++ current/arch/ppc64/mm/numa.c
@@ -58,6 +58,20 @@ EXPORT_SYMBOL(numa_memory_lookup_table);
EXPORT_SYMBOL(numa_cpumask_lookup_table);
EXPORT_SYMBOL(nr_cpus_in_node);
+static inline void discontig_init(unsigned long top)
+{
+ unsigned long entries = top >> MEMORY_INCREMENT_SHIFT;
+ unsigned long i;
+
+ if (!numa_memory_lookup_table) {
+ numa_memory_lookup_table =
+ (char *)abs_to_virt(lmb_alloc(entries * sizeof(char), 1));
+ memset(numa_memory_lookup_table, 0, entries * sizeof(char));
+ for (i = 0; i < entries ; i++)
+ numa_memory_lookup_table[i] = ARRAY_INITIALISER;
+ }
+}
+
static inline void map_cpu_to_node(int cpu, int node)
{
numa_cpu_lookup_table[cpu] = node;
@@ -320,7 +334,6 @@ static int __init parse_numa_properties(
struct device_node *memory = NULL;
int addr_cells, size_cells;
int max_domain = 0;
- long entries = lmb_end_of_DRAM() >> MEMORY_INCREMENT_SHIFT;
unsigned long i;
if (numa_enabled == 0) {
@@ -328,12 +341,7 @@ static int __init parse_numa_properties(
return -1;
}
- numa_memory_lookup_table =
- (char *)abs_to_virt(lmb_alloc(entries * sizeof(char), 1));
- memset(numa_memory_lookup_table, 0, entries * sizeof(char));
-
- for (i = 0; i < entries ; i++)
- numa_memory_lookup_table[i] = ARRAY_INITIALISER;
+ discontig_init(lmb_end_of_DRAM());
min_common_depth = find_min_common_depth();
@@ -457,21 +465,13 @@ static void __init setup_nonnuma(void)
{
unsigned long top_of_ram = lmb_end_of_DRAM();
unsigned long total_ram = lmb_phys_mem_size();
- unsigned long i;
printk(KERN_INFO "Top of RAM: 0x%lx, Total RAM: 0x%lx\n",
top_of_ram, total_ram);
printk(KERN_INFO "Memory hole size: %ldMB\n",
(top_of_ram - total_ram) >> 20);
- if (!numa_memory_lookup_table) {
- long entries = top_of_ram >> MEMORY_INCREMENT_SHIFT;
- numa_memory_lookup_table =
- (char *)abs_to_virt(lmb_alloc(entries * sizeof(char), 1));
- memset(numa_memory_lookup_table, 0, entries * sizeof(char));
- for (i = 0; i < entries ; i++)
- numa_memory_lookup_table[i] = ARRAY_INITIALISER;
- }
+ discontig_init(top_of_ram);
map_cpu_to_node(boot_cpuid, 0);
More information about the Linuxppc64-dev
mailing list