Skip to content

Commit

Permalink
[PATCH] powerpc numa: Get rid of "numa domain" terminology
Browse files Browse the repository at this point in the history
Since we effectively treat the domain ids given to us by firmare as
logical node ids, make this explicit (basically s/numa_domain/nid/).

No functional changes, only variable and function names are modified.

Signed-off-by: Nathan Lynch <nathanl@austin.ibm.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
  • Loading branch information
Nathan Lynch authored and Paul Mackerras committed Mar 22, 2006
1 parent 2e5ce39 commit cf950b7
Showing 1 changed file with 39 additions and 39 deletions.
78 changes: 39 additions & 39 deletions arch/powerpc/mm/numa.c
Original file line number Diff line number Diff line change
Expand Up @@ -191,23 +191,23 @@ static int *of_get_associativity(struct device_node *dev)
return (unsigned int *)get_property(dev, "ibm,associativity", NULL);
}

static int of_node_numa_domain(struct device_node *device)
static int of_node_to_nid(struct device_node *device)
{
int numa_domain;
int nid;
unsigned int *tmp;

if (min_common_depth == -1)
return 0;

tmp = of_get_associativity(device);
if (tmp && (tmp[0] >= min_common_depth)) {
numa_domain = tmp[min_common_depth];
nid = tmp[min_common_depth];
} else {
dbg("WARNING: no NUMA information for %s\n",
device->full_name);
numa_domain = 0;
nid = 0;
}
return numa_domain;
return nid;
}

/*
Expand Down Expand Up @@ -286,35 +286,35 @@ static unsigned long __devinit read_n_cells(int n, unsigned int **buf)
*/
static int __cpuinit numa_setup_cpu(unsigned long lcpu)
{
int numa_domain = 0;
int nid = 0;
struct device_node *cpu = find_cpu_node(lcpu);

if (!cpu) {
WARN_ON(1);
goto out;
}

numa_domain = of_node_numa_domain(cpu);
nid = of_node_to_nid(cpu);

if (numa_domain >= num_online_nodes()) {
if (nid >= num_online_nodes()) {
/*
* POWER4 LPAR uses 0xffff as invalid node,
* dont warn in this case.
*/
if (numa_domain != 0xffff)
if (nid != 0xffff)
printk(KERN_ERR "WARNING: cpu %ld "
"maps to invalid NUMA node %d\n",
lcpu, numa_domain);
numa_domain = 0;
lcpu, nid);
nid = 0;
}
out:
node_set_online(numa_domain);
node_set_online(nid);

map_cpu_to_node(lcpu, numa_domain);
map_cpu_to_node(lcpu, nid);

of_node_put(cpu);

return numa_domain;
return nid;
}

static int cpu_numa_callback(struct notifier_block *nfb,
Expand Down Expand Up @@ -399,17 +399,17 @@ static int __init parse_numa_properties(void)
* with larger node ids. In that case we force the cpu into node 0.
*/
for_each_cpu(i) {
int numa_domain;
int nid;

cpu = find_cpu_node(i);

if (cpu) {
numa_domain = of_node_numa_domain(cpu);
nid = of_node_to_nid(cpu);
of_node_put(cpu);

if (numa_domain < MAX_NUMNODES &&
max_domain < numa_domain)
max_domain = numa_domain;
if (nid < MAX_NUMNODES &&
max_domain < nid)
max_domain = nid;
}
}

Expand All @@ -418,7 +418,7 @@ static int __init parse_numa_properties(void)
while ((memory = of_find_node_by_type(memory, "memory")) != NULL) {
unsigned long start;
unsigned long size;
int numa_domain;
int nid;
int ranges;
unsigned int *memcell_buf;
unsigned int len;
Expand All @@ -439,18 +439,18 @@ static int __init parse_numa_properties(void)
start = read_n_cells(n_mem_addr_cells, &memcell_buf);
size = read_n_cells(n_mem_size_cells, &memcell_buf);

numa_domain = of_node_numa_domain(memory);
nid = of_node_to_nid(memory);

if (numa_domain >= MAX_NUMNODES) {
if (numa_domain != 0xffff)
if (nid >= MAX_NUMNODES) {
if (nid != 0xffff)
printk(KERN_ERR "WARNING: memory at %lx maps "
"to invalid NUMA node %d\n", start,
numa_domain);
numa_domain = 0;
nid);
nid = 0;
}

if (max_domain < numa_domain)
max_domain = numa_domain;
if (max_domain < nid)
max_domain = nid;

if (!(size = numa_enforce_memory_limit(start, size))) {
if (--ranges)
Expand All @@ -459,7 +459,7 @@ static int __init parse_numa_properties(void)
continue;
}

add_region(numa_domain, start >> PAGE_SHIFT,
add_region(nid, start >> PAGE_SHIFT,
size >> PAGE_SHIFT);

if (--ranges)
Expand Down Expand Up @@ -769,10 +769,10 @@ int hot_add_scn_to_nid(unsigned long scn_addr)
{
struct device_node *memory = NULL;
nodemask_t nodes;
int numa_domain = 0;
int nid = 0;

if (!numa_enabled || (min_common_depth < 0))
return numa_domain;
return nid;

while ((memory = of_find_node_by_type(memory, "memory")) != NULL) {
unsigned long start, size;
Expand All @@ -789,15 +789,15 @@ int hot_add_scn_to_nid(unsigned long scn_addr)
ha_new_range:
start = read_n_cells(n_mem_addr_cells, &memcell_buf);
size = read_n_cells(n_mem_size_cells, &memcell_buf);
numa_domain = of_node_numa_domain(memory);
nid = of_node_to_nid(memory);

/* Domains not present at boot default to 0 */
if (!node_online(numa_domain))
numa_domain = any_online_node(NODE_MASK_ALL);
if (!node_online(nid))
nid = any_online_node(NODE_MASK_ALL);

if ((scn_addr >= start) && (scn_addr < (start + size))) {
of_node_put(memory);
goto got_numa_domain;
goto got_nid;
}

if (--ranges) /* process all ranges in cell */
Expand All @@ -806,12 +806,12 @@ int hot_add_scn_to_nid(unsigned long scn_addr)
BUG(); /* section address should be found above */

/* Temporary code to ensure that returned node is not empty */
got_numa_domain:
got_nid:
nodes_setall(nodes);
while (NODE_DATA(numa_domain)->node_spanned_pages == 0) {
node_clear(numa_domain, nodes);
numa_domain = any_online_node(nodes);
while (NODE_DATA(nid)->node_spanned_pages == 0) {
node_clear(nid, nodes);
nid = any_online_node(nodes);
}
return numa_domain;
return nid;
}
#endif /* CONFIG_MEMORY_HOTPLUG */

0 comments on commit cf950b7

Please sign in to comment.