Skip to contentSkip to conversation

sparsemem base: simple NUMA remap space allocator

PATCH In review Dave Hansen 1 participant 1 message Mar 14, 2005

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 2/4 sparsemem base: simple NUMA remap space allocator

Introduce a simple allocator for the NUMA remap space. This space is very scarce, used for structures which are best allocated node local.

This mechanism is also used on non-NUMA ia64 systems with a vmem_map to keep the pgdat->node_mem_map initialized in a consistent place for all architectures.

Issues:
o alloc_remap takes a node_id where we might expect a pgdat which was intended to allow us to allocate the pgdat's using this mechanism; which we do not yet do. Could have alloc_remap_node() and alloc_remap_nid() for this purpose.

---

 memhotplug-dave/arch/i386/Kconfig        |    5 ++
 memhotplug-dave/arch/i386/mm/discontig.c |   59 ++++++++++++++++---------------
 memhotplug-dave/include/linux/bootmem.h  |    9 ++++
 memhotplug-dave/mm/page_alloc.c          |    6 ++-
 4 files changed, 50 insertions(+), 29 deletions(-)
arch/i386/Kconfig renamed from arch/i386/Kconfig~B-sparse-080-alloc_remap-i386 +5 -0
diff -puN arch/i386/Kconfig~B-sparse-080-alloc_remap-i386 arch/i386/Kconfig
@@ -787,6 +787,11 @@ config NEED_NODE_MEMMAP_SIZE
 	depends on DISCONTIGMEM
 	default y
 
+config HAVE_ARCH_ALLOC_REMAP
+	bool
+	depends on NUMA
+	default y
+
 config HIGHPTE
 	bool "Allocate 3rd-level pagetables from highmem"
 	depends on HIGHMEM4G || HIGHMEM64G
arch/i386/mm/discontig.c renamed from arch/i386/mm/discontig.c~B-sparse-080-alloc_remap-i386 +31 -28

105 lines not on this page · raw message

include/linux/bootmem.h renamed from include/linux/bootmem.h~B-sparse-080-alloc_remap-i386 +9 -0
diff -puN include/linux/bootmem.h~B-sparse-080-alloc_remap-i386 include/linux/bootmem.h
@@ -67,6 +67,15 @@ extern void * __init __alloc_bootmem_nod
 	__alloc_bootmem_node((pgdat), (x), PAGE_SIZE, 0)
 #endif /* !CONFIG_HAVE_ARCH_BOOTMEM_NODE */
 
+#ifdef CONFIG_HAVE_ARCH_ALLOC_REMAP
+extern void *alloc_remap(int nid, unsigned long size);
+#else
+static inline void *alloc_remap(int nid, unsigned long size)
+{
+	return NULL;
+}
+#endif
+
 extern unsigned long __initdata nr_kernel_pages;
 extern unsigned long __initdata nr_all_pages;
 
mm/page_alloc.c renamed from mm/page_alloc.c~B-sparse-080-alloc_remap-i386 +5 -1
diff -puN mm/page_alloc.c~B-sparse-080-alloc_remap-i386 mm/page_alloc.c
@@ -1729,6 +1729,7 @@ static void __init free_area_init_core(s
 static void __init alloc_node_mem_map(struct pglist_data *pgdat)
 {
 	unsigned long size;
+	struct page *map;
 
 	/* Skip empty nodes */
 	if (!pgdat->node_spanned_pages)
@@ -1737,7 +1738,10 @@ static void __init alloc_node_mem_map(st
 	/* ia64 gets its own node_mem_map, before this, without bootmem */
 	if (!pgdat->node_mem_map) {
 		size = (pgdat->node_spanned_pages + 1) * sizeof(struct page);
-		pgdat->node_mem_map = alloc_bootmem_node(pgdat, size);
+		map = alloc_remap(pgdat->node_id, size);
+		if (!map)
+			map = alloc_bootmem_node(pgdat, size);
+		pgdat->node_mem_map = map;
 	}
 #ifndef CONFIG_DISCONTIGMEM
 	/*

_
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>