Commit 848da4be authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] Don't let processes be scheduled on CPU-less nodes (2/3)

From: Matthew Dobson <colpatch@us.ibm.com>

This patch defines a topology macro for ppc64, nr_cpus_node(node) which
returns the number of CPUs on 'node'.  This patch also adds code to compute
and store these values in an array for quick lookup.

Test compiled and booted by Andrew Theurer (habanero@us.ibm.com) on both
x440 and ppc64.
parent 2eb57dd2
......@@ -25,6 +25,7 @@ int numa_cpu_lookup_table[NR_CPUS] = { [ 0 ... (NR_CPUS - 1)] = -1};
int numa_memory_lookup_table[MAX_MEMORY >> MEMORY_INCREMENT_SHIFT] =
{ [ 0 ... ((MAX_MEMORY >> MEMORY_INCREMENT_SHIFT) - 1)] = -1};
unsigned long numa_cpumask_lookup_table[MAX_NUMNODES];
int nr_cpus_in_node[MAX_NUMNODES] = { [0 ... (MAX_NUMNODES -1)] = 0};
struct pglist_data node_data[MAX_NUMNODES];
bootmem_data_t plat_node_bdata[MAX_NUMNODES];
......@@ -33,7 +34,10 @@ 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;
if (!(numa_cpumask_lookup_table[node] & 1UL << cpu)) {
numa_cpumask_lookup_table[node] |= 1UL << cpu;
nr_cpus_in_node[node]++;
}
}
static int __init parse_numa_properties(void)
......
......@@ -21,6 +21,7 @@ extern struct pglist_data node_data[];
extern int numa_cpu_lookup_table[];
extern int numa_memory_lookup_table[];
extern unsigned long numa_cpumask_lookup_table[];
extern int nr_cpus_in_node[];
#define MAX_MEMORY (1UL << 41)
/* 256MB regions */
......
......@@ -38,6 +38,8 @@ static inline int node_to_first_cpu(int node)
#define pcibus_to_cpumask(bus) (cpu_online_map)
#define nr_cpus_node(node) (nr_cpus_in_node[node])
/* Cross-node load balancing interval. */
#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