Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 35531
b: refs/heads/master
c: 3212fe1
h: refs/heads/master
i:
  35529: e67a5a4
  35527: 3082519
v: v3
  • Loading branch information
KAMEZAWA Hiroyuki authored and Linus Torvalds committed Sep 26, 2006
1 parent 35d824c commit 8f71c90
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 5 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 08992986497471ce575f23796268fb1b50b5c2ab
refs/heads/master: 3212fe1594e577463bc8601d28aa008f520c3377
34 changes: 31 additions & 3 deletions trunk/arch/ia64/kernel/numa.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,36 @@ EXPORT_SYMBOL(cpu_to_node_map);

cpumask_t node_to_cpu_mask[MAX_NUMNODES] __cacheline_aligned;

void __cpuinit map_cpu_to_node(int cpu, int nid)
{
int oldnid;
if (nid < 0) { /* just initialize by zero */
cpu_to_node_map[cpu] = 0;
return;
}
/* sanity check first */
oldnid = cpu_to_node_map[cpu];
if (cpu_isset(cpu, node_to_cpu_mask[oldnid])) {
return; /* nothing to do */
}
/* we don't have cpu-driven node hot add yet...
In usual case, node is created from SRAT at boot time. */
if (!node_online(nid))
nid = first_online_node;
cpu_to_node_map[cpu] = nid;
cpu_set(cpu, node_to_cpu_mask[nid]);
return;
}

void __cpuinit unmap_cpu_from_node(int cpu, int nid)
{
WARN_ON(!cpu_isset(cpu, node_to_cpu_mask[nid]));
WARN_ON(cpu_to_node_map[cpu] != nid);
cpu_to_node_map[cpu] = 0;
cpu_clear(cpu, node_to_cpu_mask[nid]);
}


/**
* build_cpu_to_node_map - setup cpu to node and node to cpumask arrays
*
Expand All @@ -49,8 +79,6 @@ void __init build_cpu_to_node_map(void)
node = node_cpuid[i].nid;
break;
}
cpu_to_node_map[cpu] = (node >= 0) ? node : 0;
if (node >= 0)
cpu_set(cpu, node_to_cpu_mask[node]);
map_cpu_to_node(cpu, node);
}
}
6 changes: 5 additions & 1 deletion trunk/arch/ia64/kernel/topology.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ int arch_register_cpu(int num)
*/
if (!can_cpei_retarget() && is_cpu_cpei_target(num))
sysfs_cpus[num].cpu.no_control = 1;
#ifdef CONFIG_NUMA
map_cpu_to_node(num, node_cpuid[num].nid);
#endif
#endif

return register_cpu(&sysfs_cpus[num].cpu, num);
Expand All @@ -45,7 +48,8 @@ int arch_register_cpu(int num)

void arch_unregister_cpu(int num)
{
return unregister_cpu(&sysfs_cpus[num].cpu);
unregister_cpu(&sysfs_cpus[num].cpu);
unmap_cpu_from_node(num, cpu_to_node(num));
}
EXPORT_SYMBOL(arch_register_cpu);
EXPORT_SYMBOL(arch_unregister_cpu);
Expand Down
4 changes: 4 additions & 0 deletions trunk/include/asm-ia64/numa.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ extern int paddr_to_nid(unsigned long paddr);

#define local_nodeid (cpu_to_node_map[smp_processor_id()])

extern void map_cpu_to_node(int cpu, int nid);
extern void unmap_cpu_from_node(int cpu, int nid);


#else /* !CONFIG_NUMA */

#define paddr_to_nid(addr) 0
Expand Down

0 comments on commit 8f71c90

Please sign in to comment.