diff options
author | Yasunori Goto <y-goto@jp.fujitsu.com> | 2006-06-23 05:03:19 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-06-23 10:42:48 -0400 |
commit | 762834e8bf46bf41ce9034d062a7c1f8563175f3 (patch) | |
tree | fb134ef41772ba61050a08cc4ed92c50cd057658 /arch/x86_64/mm | |
parent | d6277db4ab271862ed599da08d78961c70f00002 (diff) |
[PATCH] Unify pxm_to_node() and node_to_pxm()
Consolidate the various arch-specific implementations of pxm_to_node() and
node_to_pxm() into a single generic version.
Signed-off-by: Yasunori Goto <y-goto@jp.fujitsu.com>
Cc: "Luck, Tony" <tony.luck@intel.com>
Cc: Andi Kleen <ak@muc.de>
Cc: Dave Hansen <haveblue@us.ibm.com>
Cc: "Brown, Len" <len.brown@intel.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch/x86_64/mm')
-rw-r--r-- | arch/x86_64/mm/srat.c | 33 |
1 files changed, 1 insertions, 32 deletions
diff --git a/arch/x86_64/mm/srat.c b/arch/x86_64/mm/srat.c index 474df22c6ed2..502fce65e96a 100644 --- a/arch/x86_64/mm/srat.c +++ b/arch/x86_64/mm/srat.c | |||
@@ -30,7 +30,6 @@ | |||
30 | static struct acpi_table_slit *acpi_slit; | 30 | static struct acpi_table_slit *acpi_slit; |
31 | 31 | ||
32 | static nodemask_t nodes_parsed __initdata; | 32 | static nodemask_t nodes_parsed __initdata; |
33 | static nodemask_t nodes_found __initdata; | ||
34 | static struct bootnode nodes[MAX_NUMNODES] __initdata; | 33 | static struct bootnode nodes[MAX_NUMNODES] __initdata; |
35 | static struct bootnode nodes_add[MAX_NUMNODES] __initdata; | 34 | static struct bootnode nodes_add[MAX_NUMNODES] __initdata; |
36 | static int found_add_area __initdata; | 35 | static int found_add_area __initdata; |
@@ -38,33 +37,14 @@ int hotadd_percent __initdata = 0; | |||
38 | #ifndef RESERVE_HOTADD | 37 | #ifndef RESERVE_HOTADD |
39 | #define hotadd_percent 0 /* Ignore all settings */ | 38 | #define hotadd_percent 0 /* Ignore all settings */ |
40 | #endif | 39 | #endif |
41 | static u8 pxm2node[256] = { [0 ... 255] = 0xff }; | ||
42 | 40 | ||
43 | /* Too small nodes confuse the VM badly. Usually they result | 41 | /* Too small nodes confuse the VM badly. Usually they result |
44 | from BIOS bugs. */ | 42 | from BIOS bugs. */ |
45 | #define NODE_MIN_SIZE (4*1024*1024) | 43 | #define NODE_MIN_SIZE (4*1024*1024) |
46 | 44 | ||
47 | static int node_to_pxm(int n); | ||
48 | |||
49 | int pxm_to_node(int pxm) | ||
50 | { | ||
51 | if ((unsigned)pxm >= 256) | ||
52 | return -1; | ||
53 | /* Extend 0xff to (int)-1 */ | ||
54 | return (signed char)pxm2node[pxm]; | ||
55 | } | ||
56 | |||
57 | static __init int setup_node(int pxm) | 45 | static __init int setup_node(int pxm) |
58 | { | 46 | { |
59 | unsigned node = pxm2node[pxm]; | 47 | return acpi_map_pxm_to_node(pxm); |
60 | if (node == 0xff) { | ||
61 | if (nodes_weight(nodes_found) >= MAX_NUMNODES) | ||
62 | return -1; | ||
63 | node = first_unset_node(nodes_found); | ||
64 | node_set(node, nodes_found); | ||
65 | pxm2node[pxm] = node; | ||
66 | } | ||
67 | return pxm2node[pxm]; | ||
68 | } | 48 | } |
69 | 49 | ||
70 | static __init int conflicting_nodes(unsigned long start, unsigned long end) | 50 | static __init int conflicting_nodes(unsigned long start, unsigned long end) |
@@ -440,17 +420,6 @@ int __init acpi_scan_nodes(unsigned long start, unsigned long end) | |||
440 | return 0; | 420 | return 0; |
441 | } | 421 | } |
442 | 422 | ||
443 | static int node_to_pxm(int n) | ||
444 | { | ||
445 | int i; | ||
446 | if (pxm2node[n] == n) | ||
447 | return n; | ||
448 | for (i = 0; i < 256; i++) | ||
449 | if (pxm2node[i] == n) | ||
450 | return i; | ||
451 | return 0; | ||
452 | } | ||
453 | |||
454 | void __init srat_reserve_add_area(int nodeid) | 423 | void __init srat_reserve_add_area(int nodeid) |
455 | { | 424 | { |
456 | if (found_add_area && nodes_add[nodeid].end) { | 425 | if (found_add_area && nodes_add[nodeid].end) { |