debuggers.hg

view xen/arch/ia64/linux-xen/numa.c @ 0:7d21f7218375

Exact replica of unstable on 051908 + README-this
author Mukesh Rathor
date Mon May 19 15:34:57 2008 -0700 (2008-05-19)
parents
children 809b20f066fb
line source
1 /*
2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License as published by
4 * the Free Software Foundation; either version 2 of the License, or
5 * (at your option) any later version.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the Free Software
14 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
15 *
16 * ia64 kernel NUMA specific stuff
17 *
18 * Copyright (C) 2002 Erich Focht <efocht@ess.nec.de>
19 * Copyright (C) 2004 Silicon Graphics, Inc.
20 * Jesse Barnes <jbarnes@sgi.com>
21 */
22 #ifdef XEN
23 #include <xen/types.h>
24 #endif
25 #include <linux/config.h>
26 #include <linux/topology.h>
27 #include <linux/module.h>
28 #include <asm/processor.h>
29 #include <asm/smp.h>
30 #ifdef XEN
31 #include <xen/nodemask.h>
32 #endif
34 #ifdef XEN
35 nodemask_t node_online_map = { { [0] = 1UL } };
36 #endif
38 u8 cpu_to_node_map[NR_CPUS] __cacheline_aligned;
39 EXPORT_SYMBOL(cpu_to_node_map);
41 cpumask_t node_to_cpu_mask[MAX_NUMNODES] __cacheline_aligned;
43 /**
44 * build_cpu_to_node_map - setup cpu to node and node to cpumask arrays
45 *
46 * Build cpu to node mapping and initialize the per node cpu masks using
47 * info from the node_cpuid array handed to us by ACPI.
48 */
49 void __init build_cpu_to_node_map(void)
50 {
51 int cpu, i, node;
53 for(node=0; node < MAX_NUMNODES; node++)
54 cpus_clear(node_to_cpu_mask[node]);
56 for(cpu = 0; cpu < NR_CPUS; ++cpu) {
57 node = -1;
58 for (i = 0; i < NR_CPUS; ++i)
59 if (cpu_physical_id(cpu) == node_cpuid[i].phys_id) {
60 node = node_cpuid[i].nid;
61 break;
62 }
63 cpu_to_node_map[cpu] = (node >= 0) ? node : 0;
64 if (node >= 0)
65 cpu_set(cpu, node_to_cpu_mask[node]);
66 }
67 }