diff options
-rw-r--r-- | arch/x86/include/asm/topology.h | 30 | ||||
-rw-r--r-- | arch/x86/kernel/smpboot.c | 5 | ||||
-rw-r--r-- | arch/x86/mm/Makefile | 2 | ||||
-rw-r--r-- | arch/x86/mm/numa.c | 71 | ||||
-rw-r--r-- | arch/x86/mm/numa_64.c | 69 |
5 files changed, 83 insertions, 94 deletions
diff --git a/arch/x86/include/asm/topology.h b/arch/x86/include/asm/topology.h index 216a960d4f10..dc31d929da04 100644 --- a/arch/x86/include/asm/topology.h +++ b/arch/x86/include/asm/topology.h | |||
@@ -44,9 +44,6 @@ | |||
44 | 44 | ||
45 | #ifdef CONFIG_X86_32 | 45 | #ifdef CONFIG_X86_32 |
46 | 46 | ||
47 | /* Mappings between node number and cpus on that node. */ | ||
48 | extern cpumask_t node_to_cpumask_map[]; | ||
49 | |||
50 | /* Mappings between logical cpu number and node number */ | 47 | /* Mappings between logical cpu number and node number */ |
51 | extern int cpu_to_node_map[]; | 48 | extern int cpu_to_node_map[]; |
52 | 49 | ||
@@ -57,19 +54,8 @@ static inline int cpu_to_node(int cpu) | |||
57 | } | 54 | } |
58 | #define early_cpu_to_node(cpu) cpu_to_node(cpu) | 55 | #define early_cpu_to_node(cpu) cpu_to_node(cpu) |
59 | 56 | ||
60 | /* Returns a bitmask of CPUs on Node 'node'. */ | ||
61 | static inline const struct cpumask *cpumask_of_node(int node) | ||
62 | { | ||
63 | return &node_to_cpumask_map[node]; | ||
64 | } | ||
65 | |||
66 | static inline void setup_node_to_cpumask_map(void) { } | ||
67 | |||
68 | #else /* CONFIG_X86_64 */ | 57 | #else /* CONFIG_X86_64 */ |
69 | 58 | ||
70 | /* Mappings between node number and cpus on that node. */ | ||
71 | extern cpumask_t *node_to_cpumask_map; | ||
72 | |||
73 | /* Mappings between logical cpu number and node number */ | 59 | /* Mappings between logical cpu number and node number */ |
74 | DECLARE_EARLY_PER_CPU(int, x86_cpu_to_node_map); | 60 | DECLARE_EARLY_PER_CPU(int, x86_cpu_to_node_map); |
75 | 61 | ||
@@ -80,7 +66,6 @@ DECLARE_PER_CPU(int, node_number); | |||
80 | #ifdef CONFIG_DEBUG_PER_CPU_MAPS | 66 | #ifdef CONFIG_DEBUG_PER_CPU_MAPS |
81 | extern int cpu_to_node(int cpu); | 67 | extern int cpu_to_node(int cpu); |
82 | extern int early_cpu_to_node(int cpu); | 68 | extern int early_cpu_to_node(int cpu); |
83 | extern const cpumask_t *cpumask_of_node(int node); | ||
84 | 69 | ||
85 | #else /* !CONFIG_DEBUG_PER_CPU_MAPS */ | 70 | #else /* !CONFIG_DEBUG_PER_CPU_MAPS */ |
86 | 71 | ||
@@ -96,18 +81,25 @@ static inline int early_cpu_to_node(int cpu) | |||
96 | return early_per_cpu(x86_cpu_to_node_map, cpu); | 81 | return early_per_cpu(x86_cpu_to_node_map, cpu); |
97 | } | 82 | } |
98 | 83 | ||
84 | #endif /* !CONFIG_DEBUG_PER_CPU_MAPS */ | ||
85 | |||
86 | #endif /* CONFIG_X86_64 */ | ||
87 | |||
88 | /* Mappings between node number and cpus on that node. */ | ||
89 | extern cpumask_t *node_to_cpumask_map; | ||
90 | |||
91 | #ifdef CONFIG_DEBUG_PER_CPU_MAPS | ||
92 | extern const cpumask_t *cpumask_of_node(int node); | ||
93 | #else | ||
99 | /* Returns a pointer to the cpumask of CPUs on Node 'node'. */ | 94 | /* Returns a pointer to the cpumask of CPUs on Node 'node'. */ |
100 | static inline const cpumask_t *cpumask_of_node(int node) | 95 | static inline const cpumask_t *cpumask_of_node(int node) |
101 | { | 96 | { |
102 | return &node_to_cpumask_map[node]; | 97 | return &node_to_cpumask_map[node]; |
103 | } | 98 | } |
104 | 99 | #endif | |
105 | #endif /* !CONFIG_DEBUG_PER_CPU_MAPS */ | ||
106 | 100 | ||
107 | extern void setup_node_to_cpumask_map(void); | 101 | extern void setup_node_to_cpumask_map(void); |
108 | 102 | ||
109 | #endif /* CONFIG_X86_64 */ | ||
110 | |||
111 | /* | 103 | /* |
112 | * Returns the number of the node containing Node 'node'. This | 104 | * Returns the number of the node containing Node 'node'. This |
113 | * architecture is flat, so it is a pretty simple function! | 105 | * architecture is flat, so it is a pretty simple function! |
diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c index 7f051c170add..c55639b1ab8a 100644 --- a/arch/x86/kernel/smpboot.c +++ b/arch/x86/kernel/smpboot.c | |||
@@ -115,11 +115,6 @@ EXPORT_PER_CPU_SYMBOL(cpu_info); | |||
115 | atomic_t init_deasserted; | 115 | atomic_t init_deasserted; |
116 | 116 | ||
117 | #if defined(CONFIG_NUMA) && defined(CONFIG_X86_32) | 117 | #if defined(CONFIG_NUMA) && defined(CONFIG_X86_32) |
118 | |||
119 | /* which logical CPUs are on which nodes */ | ||
120 | cpumask_t node_to_cpumask_map[MAX_NUMNODES] __read_mostly = | ||
121 | { [0 ... MAX_NUMNODES-1] = CPU_MASK_NONE }; | ||
122 | EXPORT_SYMBOL(node_to_cpumask_map); | ||
123 | /* which node each logical CPU is on */ | 118 | /* which node each logical CPU is on */ |
124 | int cpu_to_node_map[NR_CPUS] __read_mostly = { [0 ... NR_CPUS-1] = 0 }; | 119 | int cpu_to_node_map[NR_CPUS] __read_mostly = { [0 ... NR_CPUS-1] = 0 }; |
125 | EXPORT_SYMBOL(cpu_to_node_map); | 120 | EXPORT_SYMBOL(cpu_to_node_map); |
diff --git a/arch/x86/mm/Makefile b/arch/x86/mm/Makefile index 08537747cb58..fdd30d08ab52 100644 --- a/arch/x86/mm/Makefile +++ b/arch/x86/mm/Makefile | |||
@@ -14,7 +14,7 @@ obj-$(CONFIG_MMIOTRACE) += mmiotrace.o | |||
14 | mmiotrace-y := kmmio.o pf_in.o mmio-mod.o | 14 | mmiotrace-y := kmmio.o pf_in.o mmio-mod.o |
15 | obj-$(CONFIG_MMIOTRACE_TEST) += testmmiotrace.o | 15 | obj-$(CONFIG_MMIOTRACE_TEST) += testmmiotrace.o |
16 | 16 | ||
17 | obj-$(CONFIG_NUMA) += numa_$(BITS).o | 17 | obj-$(CONFIG_NUMA) += numa.o numa_$(BITS).o |
18 | obj-$(CONFIG_K8_NUMA) += k8topology_64.o | 18 | obj-$(CONFIG_K8_NUMA) += k8topology_64.o |
19 | obj-$(CONFIG_ACPI_NUMA) += srat_$(BITS).o | 19 | obj-$(CONFIG_ACPI_NUMA) += srat_$(BITS).o |
20 | 20 | ||
diff --git a/arch/x86/mm/numa.c b/arch/x86/mm/numa.c new file mode 100644 index 000000000000..f3a19e939e80 --- /dev/null +++ b/arch/x86/mm/numa.c | |||
@@ -0,0 +1,71 @@ | |||
1 | /* Common code for 32 and 64-bit NUMA */ | ||
2 | #include <linux/topology.h> | ||
3 | #include <linux/module.h> | ||
4 | #include <linux/bootmem.h> | ||
5 | |||
6 | #ifdef CONFIG_DEBUG_PER_CPU_MAPS | ||
7 | # define DBG(x...) printk(KERN_DEBUG x) | ||
8 | #else | ||
9 | # define DBG(x...) | ||
10 | #endif | ||
11 | |||
12 | /* | ||
13 | * Which logical CPUs are on which nodes | ||
14 | */ | ||
15 | cpumask_t *node_to_cpumask_map; | ||
16 | EXPORT_SYMBOL(node_to_cpumask_map); | ||
17 | |||
18 | /* | ||
19 | * Allocate node_to_cpumask_map based on number of available nodes | ||
20 | * Requires node_possible_map to be valid. | ||
21 | * | ||
22 | * Note: node_to_cpumask() is not valid until after this is done. | ||
23 | * (Use CONFIG_DEBUG_PER_CPU_MAPS to check this.) | ||
24 | */ | ||
25 | void __init setup_node_to_cpumask_map(void) | ||
26 | { | ||
27 | unsigned int node, num = 0; | ||
28 | cpumask_t *map; | ||
29 | |||
30 | /* setup nr_node_ids if not done yet */ | ||
31 | if (nr_node_ids == MAX_NUMNODES) { | ||
32 | for_each_node_mask(node, node_possible_map) | ||
33 | num = node; | ||
34 | nr_node_ids = num + 1; | ||
35 | } | ||
36 | |||
37 | /* allocate the map */ | ||
38 | map = alloc_bootmem_low(nr_node_ids * sizeof(cpumask_t)); | ||
39 | DBG("node_to_cpumask_map at %p for %d nodes\n", map, nr_node_ids); | ||
40 | |||
41 | pr_debug("Node to cpumask map at %p for %d nodes\n", | ||
42 | map, nr_node_ids); | ||
43 | |||
44 | /* node_to_cpumask() will now work */ | ||
45 | node_to_cpumask_map = map; | ||
46 | } | ||
47 | |||
48 | #ifdef CONFIG_DEBUG_PER_CPU_MAPS | ||
49 | /* | ||
50 | * Returns a pointer to the bitmask of CPUs on Node 'node'. | ||
51 | */ | ||
52 | const cpumask_t *cpumask_of_node(int node) | ||
53 | { | ||
54 | if (node_to_cpumask_map == NULL) { | ||
55 | printk(KERN_WARNING | ||
56 | "cpumask_of_node(%d): no node_to_cpumask_map!\n", | ||
57 | node); | ||
58 | dump_stack(); | ||
59 | return cpu_online_mask; | ||
60 | } | ||
61 | if (node >= nr_node_ids) { | ||
62 | printk(KERN_WARNING | ||
63 | "cpumask_of_node(%d): node > nr_node_ids(%d)\n", | ||
64 | node, nr_node_ids); | ||
65 | dump_stack(); | ||
66 | return cpu_none_mask; | ||
67 | } | ||
68 | return &node_to_cpumask_map[node]; | ||
69 | } | ||
70 | EXPORT_SYMBOL(cpumask_of_node); | ||
71 | #endif | ||
diff --git a/arch/x86/mm/numa_64.c b/arch/x86/mm/numa_64.c index 48bf396b6e79..eee149078862 100644 --- a/arch/x86/mm/numa_64.c +++ b/arch/x86/mm/numa_64.c | |||
@@ -20,12 +20,6 @@ | |||
20 | #include <asm/acpi.h> | 20 | #include <asm/acpi.h> |
21 | #include <asm/k8.h> | 21 | #include <asm/k8.h> |
22 | 22 | ||
23 | #ifdef CONFIG_DEBUG_PER_CPU_MAPS | ||
24 | # define DBG(x...) printk(KERN_DEBUG x) | ||
25 | #else | ||
26 | # define DBG(x...) | ||
27 | #endif | ||
28 | |||
29 | struct pglist_data *node_data[MAX_NUMNODES] __read_mostly; | 23 | struct pglist_data *node_data[MAX_NUMNODES] __read_mostly; |
30 | EXPORT_SYMBOL(node_data); | 24 | EXPORT_SYMBOL(node_data); |
31 | 25 | ||
@@ -49,12 +43,6 @@ DEFINE_EARLY_PER_CPU(int, x86_cpu_to_node_map, NUMA_NO_NODE); | |||
49 | EXPORT_EARLY_PER_CPU_SYMBOL(x86_cpu_to_node_map); | 43 | EXPORT_EARLY_PER_CPU_SYMBOL(x86_cpu_to_node_map); |
50 | 44 | ||
51 | /* | 45 | /* |
52 | * Which logical CPUs are on which nodes | ||
53 | */ | ||
54 | cpumask_t *node_to_cpumask_map; | ||
55 | EXPORT_SYMBOL(node_to_cpumask_map); | ||
56 | |||
57 | /* | ||
58 | * Given a shift value, try to populate memnodemap[] | 46 | * Given a shift value, try to populate memnodemap[] |
59 | * Returns : | 47 | * Returns : |
60 | * 1 if OK | 48 | * 1 if OK |
@@ -661,36 +649,6 @@ void __init init_cpu_to_node(void) | |||
661 | #endif | 649 | #endif |
662 | 650 | ||
663 | 651 | ||
664 | /* | ||
665 | * Allocate node_to_cpumask_map based on number of available nodes | ||
666 | * Requires node_possible_map to be valid. | ||
667 | * | ||
668 | * Note: node_to_cpumask() is not valid until after this is done. | ||
669 | * (Use CONFIG_DEBUG_PER_CPU_MAPS to check this.) | ||
670 | */ | ||
671 | void __init setup_node_to_cpumask_map(void) | ||
672 | { | ||
673 | unsigned int node, num = 0; | ||
674 | cpumask_t *map; | ||
675 | |||
676 | /* setup nr_node_ids if not done yet */ | ||
677 | if (nr_node_ids == MAX_NUMNODES) { | ||
678 | for_each_node_mask(node, node_possible_map) | ||
679 | num = node; | ||
680 | nr_node_ids = num + 1; | ||
681 | } | ||
682 | |||
683 | /* allocate the map */ | ||
684 | map = alloc_bootmem_low(nr_node_ids * sizeof(cpumask_t)); | ||
685 | DBG("node_to_cpumask_map at %p for %d nodes\n", map, nr_node_ids); | ||
686 | |||
687 | pr_debug("Node to cpumask map at %p for %d nodes\n", | ||
688 | map, nr_node_ids); | ||
689 | |||
690 | /* node_to_cpumask() will now work */ | ||
691 | node_to_cpumask_map = map; | ||
692 | } | ||
693 | |||
694 | void __cpuinit numa_set_node(int cpu, int node) | 652 | void __cpuinit numa_set_node(int cpu, int node) |
695 | { | 653 | { |
696 | int *cpu_to_node_map = early_per_cpu_ptr(x86_cpu_to_node_map); | 654 | int *cpu_to_node_map = early_per_cpu_ptr(x86_cpu_to_node_map); |
@@ -799,33 +757,6 @@ int early_cpu_to_node(int cpu) | |||
799 | return per_cpu(x86_cpu_to_node_map, cpu); | 757 | return per_cpu(x86_cpu_to_node_map, cpu); |
800 | } | 758 | } |
801 | 759 | ||
802 | |||
803 | /* empty cpumask */ | ||
804 | static const cpumask_t cpu_mask_none; | ||
805 | |||
806 | /* | ||
807 | * Returns a pointer to the bitmask of CPUs on Node 'node'. | ||
808 | */ | ||
809 | const cpumask_t *cpumask_of_node(int node) | ||
810 | { | ||
811 | if (node_to_cpumask_map == NULL) { | ||
812 | printk(KERN_WARNING | ||
813 | "cpumask_of_node(%d): no node_to_cpumask_map!\n", | ||
814 | node); | ||
815 | dump_stack(); | ||
816 | return (const cpumask_t *)&cpu_online_map; | ||
817 | } | ||
818 | if (node >= nr_node_ids) { | ||
819 | printk(KERN_WARNING | ||
820 | "cpumask_of_node(%d): node > nr_node_ids(%d)\n", | ||
821 | node, nr_node_ids); | ||
822 | dump_stack(); | ||
823 | return &cpu_mask_none; | ||
824 | } | ||
825 | return &node_to_cpumask_map[node]; | ||
826 | } | ||
827 | EXPORT_SYMBOL(cpumask_of_node); | ||
828 | |||
829 | /* | 760 | /* |
830 | * --------- end of debug versions of the numa functions --------- | 761 | * --------- end of debug versions of the numa functions --------- |
831 | */ | 762 | */ |