: fake numa for x86_64 patches
This patch set resolves issues with running fake numa on x86_64. We have also extended the command line numa=fake=NUM command line option to specify different size nodes. The default NODES_SHIFT is also incremented from 6 to 8 to allow MAX_NUM_NODES to be 256.
Patch [1/4]: Add the e820_hole_size to give the size of hole in a given address range
Patch [2/4]: Increase the NODE_SHIFT from 6 to 8.
Patch [3/4]: Fix the existing numa=fake so that ioholes are appropriately configured. Currently machines that have sizeable IO holes don't work with numa=fake>4.
Patch[4/4]: Extend the command line so that user can specify different size nodes on a command line.
Quoted 8 lines · On Wed, 22 Nov 2006 17:34:04 -0800 Rohit Seth <[email protected]> wrote:
This patch set resolves issues with running fake numa on
x86_64. We have also extended the command line numa=fake=NUM command line option to specify different size nodes. The defaultNODES_SHIFTis also incremented from 6 to 8 to allowMAX_NUM_NODESto be 256.Patch [1/4]: Add the
e820_hole_sizeto give the size of hole in a given address range
Quoted 8 lines
Patch [2/4]: Increase the
NODE_SHIFTfrom 6 to 8.Patch [3/4]: Fix the existing numa=fake so that ioholes are appropriately configured. Currently machines that have sizeable IO holes don't work with numa=fake>4.
Patch[4/4]: Extend the command line so that user can specify different size nodes on a command line.
These patches comprehensively conflict with the below. It looks like the fake-numa patches need more testing, so I'll drop Amul's patch.
Also, please don't send multiple patches under the same title. I have four patches, all the same. Is lovingly covered in
http://www.zip.com.au/~akpm/linux/patches/stuff/tpp.txt, section 2.
Thanks.
From: Amul Shah <[email protected]>
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).
---
arch/x86_64/kernel/e820.c | 6 ++ arch/x86_64/kernel/setup.c | 4 + arch/x86_64/mm/numa.c | 73 +++++++++++++++++++++++++++++----- include/asm-x86_64/e820.h | 1 include/asm-x86_64/mmzone.h | 13 +++--- 5 files changed, 82 insertions(+), 15 deletions(-)
arch/x86_64/kernel/e820.c renamed from arch/x86_64/kernel/e820.c~x86_64-make-the-numa-hash-function-nodemap-allocation +6 -0
@@ -83,6 +83,12 @@ static inline int bad_addr(unsigned longreturn 1 ; } +/* NUMA memory to node map */ +if (last >= nodemap_addr && addr < nodemap_addr + nodemap_size) { + *addrp = nodemap_addr + nodemap_size; +return 1 ; + } +/* XXX ramdisk image here? */ return 0 ; }
arch/x86_64/kernel/setup.c renamed from arch/x86_64/kernel/setup.c~x86_64-make-the-numa-hash-function-nodemap-allocation +4 -0
@@ -445,6 +445,10 @@ void __init setup_arch(char **cmdline_p)if (ebda_addr)reserve_bootmem_generic (ebda_addr, ebda_size); +/* reserve nodemap region */ +if (nodemap_addr) +reserve_bootmem_generic (nodemap_addr, nodemap_size); +#ifdef CONFIG_SMP /* * But first pinch a few for the stack/trampoline stuff
arch/x86_64/mm/numa.c renamed from arch/x86_64/mm/numa.c~x86_64-make-the-numa-hash-function-nodemap-allocation +64 -9
104 lines not on this page · raw message
include/asm-x86_64/e820.h renamed from include/asm-x86_64/e820.h~x86_64-make-the-numa-hash-function-nodemap-allocation +1 -0
@@ -56,6 +56,7 @@ extern void finish_e820_parsing(void);extern struct e820map e820;extern unsigned ebda_addr, ebda_size; +extern unsigned long nodemap_addr, nodemap_size;#endif /*!__ASSEMBLY__*/ #endif /*__E820_HEADER*/
include/asm-x86_64/mmzone.h renamed from include/asm-x86_64/mmzone.h~x86_64-make-the-numa-hash-function-nodemap-allocation +7 -6
@@ -11,24 +11,25 @@#include <asm/smp.h> -/* Should really switch to dynamic allocation at some point */ -#define NODEMAPSIZE 0x4fff -/* Simple perfect hash to map physical addresses to node numbers */ struct memnode {int shift; -u8 map[NODEMAPSIZE ]; -}____cacheline_aligned ; +unsigned int mapsize; +u8 *map; +u8 embedded_map[64 -16 ]; +}____cacheline_aligned ;/* total size = 64 bytes */ extern struct memnode memnode;#define memnode_shift memnode.shift#define memnodemap memnode.map +#define memnodemapsize memnode.mapsizeextern struct pglist_data *node_data[];static inline __attribute__((pure))int phys_to_nid (unsigned long addr) {unsigned nid; -VIRTUAL_BUG_ON ((addr >> memnode_shift) >=NODEMAPSIZE ); +VIRTUAL_BUG_ON (!memnodemap); +VIRTUAL_BUG_ON ((addr >> memnode_shift) >= memnodemapsize); nid = memnodemap[addr >> memnode_shift];VIRTUAL_BUG_ON (nid >=MAX_NUMNODES || !node_data[nid]);return nid;
_