diff options
author | Amul Shah <amul.shah@unisys.com> | 2007-02-13 07:26:19 -0500 |
---|---|---|
committer | Andi Kleen <andi@basil.nowhere.org> | 2007-02-13 07:26:19 -0500 |
commit | 076422d2af7e3d8e72c6e70843f6ea377714b082 (patch) | |
tree | 942ec9d2e7f3f74d6694af99a745ee74ef851268 /include/asm-x86_64/mmzone.h | |
parent | 0812a579c92fefa57506821fa08e90f47cb6dbdd (diff) |
[PATCH] x86-64: Allocate the NUMA hash function nodemap dynamically
Remove the statically allocated memory to NUMA node hash map in favor of a
dynamically allocated memory to node hash map (it is cache aligned).
This patch has the nice side effect in that it allows the hash map to grow
for systems with large amounts of memory (256GB - 1TB), but suffer from
having small PCI space tacked onto the boot node (which is somewhere
between 192MB to 512MB on the ES7000).
Signed-off-by: Amul Shah <amul.shah@unisys.com>
Signed-off-by: Andi Kleen <ak@suse.de>
Cc: Andi Kleen <ak@suse.de>
Cc: Rohit Seth <rohitseth@google.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Diffstat (limited to 'include/asm-x86_64/mmzone.h')
-rw-r--r-- | include/asm-x86_64/mmzone.h | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/include/asm-x86_64/mmzone.h b/include/asm-x86_64/mmzone.h index c38ebdf6f426..39ef106986eb 100644 --- a/include/asm-x86_64/mmzone.h +++ b/include/asm-x86_64/mmzone.h | |||
@@ -11,24 +11,25 @@ | |||
11 | 11 | ||
12 | #include <asm/smp.h> | 12 | #include <asm/smp.h> |
13 | 13 | ||
14 | /* Should really switch to dynamic allocation at some point */ | ||
15 | #define NODEMAPSIZE 0x4fff | ||
16 | |||
17 | /* Simple perfect hash to map physical addresses to node numbers */ | 14 | /* Simple perfect hash to map physical addresses to node numbers */ |
18 | struct memnode { | 15 | struct memnode { |
19 | int shift; | 16 | int shift; |
20 | u8 map[NODEMAPSIZE]; | 17 | unsigned int mapsize; |
21 | } ____cacheline_aligned; | 18 | u8 *map; |
19 | u8 embedded_map[64-16]; | ||
20 | } ____cacheline_aligned; /* total size = 64 bytes */ | ||
22 | extern struct memnode memnode; | 21 | extern struct memnode memnode; |
23 | #define memnode_shift memnode.shift | 22 | #define memnode_shift memnode.shift |
24 | #define memnodemap memnode.map | 23 | #define memnodemap memnode.map |
24 | #define memnodemapsize memnode.mapsize | ||
25 | 25 | ||
26 | extern struct pglist_data *node_data[]; | 26 | extern struct pglist_data *node_data[]; |
27 | 27 | ||
28 | static inline __attribute__((pure)) int phys_to_nid(unsigned long addr) | 28 | static inline __attribute__((pure)) int phys_to_nid(unsigned long addr) |
29 | { | 29 | { |
30 | unsigned nid; | 30 | unsigned nid; |
31 | VIRTUAL_BUG_ON((addr >> memnode_shift) >= NODEMAPSIZE); | 31 | VIRTUAL_BUG_ON(!memnodemap); |
32 | VIRTUAL_BUG_ON((addr >> memnode_shift) >= memnodemapsize); | ||
32 | nid = memnodemap[addr >> memnode_shift]; | 33 | nid = memnodemap[addr >> memnode_shift]; |
33 | VIRTUAL_BUG_ON(nid >= MAX_NUMNODES || !node_data[nid]); | 34 | VIRTUAL_BUG_ON(nid >= MAX_NUMNODES || !node_data[nid]); |
34 | return nid; | 35 | return nid; |