Commit e3d87eab authored by Anton Blanchard's avatar Anton Blanchard

ppc64: clear up the cpu<-> node mappings, and cache them, from Matt Dobson

parent 43da12f7
...@@ -69,8 +69,6 @@ struct mmu_context_queue_t mmu_context_queue; ...@@ -69,8 +69,6 @@ struct mmu_context_queue_t mmu_context_queue;
int mem_init_done; int mem_init_done;
unsigned long ioremap_bot = IMALLOC_BASE; unsigned long ioremap_bot = IMALLOC_BASE;
static int boot_mapsize;
extern pgd_t swapper_pg_dir[]; extern pgd_t swapper_pg_dir[];
extern char __init_begin, __init_end; extern char __init_begin, __init_end;
extern char _start[], _end[]; extern char _start[], _end[];
...@@ -454,6 +452,7 @@ void __init do_init_bootmem(void) ...@@ -454,6 +452,7 @@ void __init do_init_bootmem(void)
unsigned long i; unsigned long i;
unsigned long start, bootmap_pages; unsigned long start, bootmap_pages;
unsigned long total_pages = lmb_end_of_DRAM() >> PAGE_SHIFT; unsigned long total_pages = lmb_end_of_DRAM() >> PAGE_SHIFT;
int boot_mapsize;
/* /*
* Find an area to use for the bootmem bitmap. Calculate the size of * Find an area to use for the bootmem bitmap. Calculate the size of
......
...@@ -24,10 +24,18 @@ ...@@ -24,10 +24,18 @@
int numa_cpu_lookup_table[NR_CPUS] = { [ 0 ... (NR_CPUS - 1)] = -1}; int numa_cpu_lookup_table[NR_CPUS] = { [ 0 ... (NR_CPUS - 1)] = -1};
int numa_memory_lookup_table[MAX_MEMORY >> MEMORY_INCREMENT_SHIFT] = int numa_memory_lookup_table[MAX_MEMORY >> MEMORY_INCREMENT_SHIFT] =
{ [ 0 ... ((MAX_MEMORY >> MEMORY_INCREMENT_SHIFT) - 1)] = -1}; { [ 0 ... ((MAX_MEMORY >> MEMORY_INCREMENT_SHIFT) - 1)] = -1};
unsigned long numa_cpumask_lookup_table[MAX_NUMNODES];
struct pglist_data node_data[MAX_NUMNODES]; struct pglist_data node_data[MAX_NUMNODES];
bootmem_data_t plat_node_bdata[MAX_NUMNODES]; bootmem_data_t plat_node_bdata[MAX_NUMNODES];
static inline void map_cpu_to_node(int cpu, int node)
{
dbg("cpu %d maps to domain %d\n", cpu, node);
numa_cpu_lookup_table[cpu] = node;
numa_cpumask_lookup_table[node] |= 1UL << cpu;
}
static int __init parse_numa_properties(void) static int __init parse_numa_properties(void)
{ {
struct device_node *cpu; struct device_node *cpu;
...@@ -87,9 +95,7 @@ static int __init parse_numa_properties(void) ...@@ -87,9 +95,7 @@ static int __init parse_numa_properties(void)
if (max_domain < numa_domain) if (max_domain < numa_domain)
max_domain = numa_domain; max_domain = numa_domain;
numa_cpu_lookup_table[cpu_nr] = numa_domain; map_cpu_to_node(cpu_nr, numa_domain);
dbg("cpu %d maps to domain %d\n", cpu_nr, numa_domain);
} }
for (memory = find_type_devices("memory"); memory; for (memory = find_type_devices("memory"); memory;
...@@ -134,7 +140,7 @@ static int __init parse_numa_properties(void) ...@@ -134,7 +140,7 @@ static int __init parse_numa_properties(void)
/* FIXME */ /* FIXME */
if (numa_domain == 0xffff) { if (numa_domain == 0xffff) {
dbg("cpu has no numa doman\n"); dbg("memory has no numa doman\n");
numa_domain = 0; numa_domain = 0;
} }
......
...@@ -18,9 +18,9 @@ extern struct pglist_data node_data[]; ...@@ -18,9 +18,9 @@ extern struct pglist_data node_data[];
* Following are specific to this numa platform. * Following are specific to this numa platform.
*/ */
extern int numa_node_exists[];
extern int numa_cpu_lookup_table[]; extern int numa_cpu_lookup_table[];
extern int numa_memory_lookup_table[]; extern int numa_memory_lookup_table[];
extern unsigned long numa_cpumask_lookup_table[];
#define MAX_MEMORY (1UL << 41) #define MAX_MEMORY (1UL << 41)
/* 256MB regions */ /* 256MB regions */
......
...@@ -20,32 +20,23 @@ static inline int cpu_to_node(int cpu) ...@@ -20,32 +20,23 @@ static inline int cpu_to_node(int cpu)
return node; return node;
} }
static inline int node_to_first_cpu(int node) #define memblk_to_node(memblk) (memblk)
{
int cpu;
for(cpu = 0; cpu < NR_CPUS; cpu++) #define parent_node(node) (node)
if (numa_cpu_lookup_table[cpu] == node)
return cpu;
BUG(); /* couldn't find a cpu on given node */
return -1;
}
static inline unsigned long node_to_cpumask(int node) static inline unsigned long node_to_cpumask(int node)
{ {
int cpu; return numa_cpumask_lookup_table[node];
unsigned long mask = 0UL; }
if (sizeof(unsigned long) * 8 < NR_CPUS) static inline int node_to_first_cpu(int node)
BUG(); {
return __ffs(node_to_cpumask(node));
}
for(cpu = 0; cpu < NR_CPUS; cpu++) #define node_to_memblk(node) (node)
if (numa_cpu_lookup_table[cpu] == node)
mask |= 1UL << cpu;
return mask; #define pcibus_to_cpumask(bus) (cpu_online_map)
}
/* Cross-node load balancing interval. */ /* Cross-node load balancing interval. */
#define NODE_BALANCE_RATE 10 #define NODE_BALANCE_RATE 10
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment