abstract discontigmem setup
Subsystems (3)
PATCH 3/5 abstract discontigmem setup
memory_present() is how each arch/subarch will tell sparsemem and discontigmem where all of its memory is. This is what triggers sparse to go out and create its mappings for the memory, as well as allocate the mem_map[].
By: Andy Whitcroft <[email protected]>
Signed-off-by Dave Hansen <[email protected]>
---
sparse-dave/arch/i386/Kconfig | 10 +++++++ sparse-dave/arch/i386/kernel/numaq.c | 6 +++- sparse-dave/arch/i386/kernel/srat.c | 9 +++++- sparse-dave/arch/i386/mm/discontig.c | 49 ++++++++++++++++++++++------------- sparse-dave/arch/ppc64/mm/numa.c | 19 ++++++++++--- sparse-dave/include/linux/mmzone.h | 11 +++++++ 6 files changed, 79 insertions(+), 25 deletions(-)
arch/i386/kernel/numaq.c renamed from arch/i386/kernel/numaq.c~A3.1-abstract-discontig +5 -1
@@ -32,7 +32,7 @@#include <asm/numaq.h> /* These are needed before the pgdat's are created */ -extern long node_start_pfn[], node_end_pfn[]; +extern long node_start_pfn[], node_end_pfn[], node_remap_size[];#define MB_TO_PAGES (addr) ((addr) << (20 - PAGE_SHIFT))
@@ -59,6 +59,10 @@ static void __init smp_dump_qct(void) eq->hi_shrd_mem_start - eq->priv_mem_size); node_end_pfn[node] =MB_TO_PAGES ( eq->hi_shrd_mem_start + eq->hi_shrd_mem_size); + +memory_present (node, + node_start_pfn[node], node_end_pfn[node]); + node_remap_size[node] =node_memmap_size_bytes (node); } } }
arch/i386/kernel/srat.c renamed from arch/i386/kernel/srat.c~A3.1-abstract-discontig +8 -1
@@ -58,7 +58,7 @@ static int num_memory_chunks; /* totalstatic int zholes_size_init;static unsigned long zholes_size[MAX_NUMNODES *MAX_NR_ZONES ]; -extern unsigned long node_start_pfn[], node_end_pfn[]; +extern unsigned long node_start_pfn[], node_end_pfn[], node_remap_size[];extern void *boot_ioremap (unsigned long ,unsigned long );
@@ -286,6 +286,13 @@ static int __init acpi20_parse_srat(stru } } } +for_each_online_node (nid) { +unsigned long start = node_start_pfn[nid]; +unsigned long end = node_end_pfn[nid]; + +memory_present (nid, start, end); + node_remap_size[nid] =node_memmap_size_bytes (nid, start, end); + }return 1 ; out_fail:return 0 ;
arch/i386/mm/discontig.c renamed from arch/i386/mm/discontig.c~A3.1-abstract-discontig +31 -18
75 lines not on this page · raw message
arch/ppc64/mm/numa.c renamed from arch/ppc64/mm/numa.c~A3.1-abstract-discontig +14 -5
@@ -58,6 +58,17 @@ EXPORT_SYMBOL(numa_memory_lookup_table);EXPORT_SYMBOL (numa_cpumask_lookup_table);EXPORT_SYMBOL (nr_cpus_in_node); +void memory_present (int nid,unsigned long start_pfn, +unsigned long end_pfn) +{ +unsigned long i; +unsigned long start_addr = start <<PAGE_SHIFT ; +unsigned long end_addr = end <<PAGE_SHIFT ; + +for (i = start ; i < end; i +=MEMORY_INCREMENT ) + numa_memory_lookup_table[i >>MEMORY_INCREMENT_SHIFT ] = nid; +} +static inline void map_cpu_to_node (int cpu,int node) { numa_cpu_lookup_table[cpu] = node;
@@ -378,9 +389,8 @@ new_range: size /PAGE_SIZE ; } -for (i = start ; i < (start+size); i +=MEMORY_INCREMENT ) - numa_memory_lookup_table[i >>MEMORY_INCREMENT_SHIFT ] = - numa_domain; +memory_present (numa_domain, start >>PAGE_SHIFT , + (start + size) >>PAGE_SHIFT ); ranges--;if (ranges)
@@ -428,8 +438,7 @@ static void __init setup_nonnuma(void) init_node_data[0 ].node_start_pfn =0 ; init_node_data[0 ].node_spanned_pages =lmb_end_of_DRAM () /PAGE_SIZE ; -for (i =0 ; i < top_of_ram; i +=MEMORY_INCREMENT ) - numa_memory_lookup_table[i >>MEMORY_INCREMENT_SHIFT ] =0 ; +memory_present (0 ,0 , init_node_data[0 ].node_spanned_pages); node0_io_hole_size = top_of_ram - total_ram; }
include/linux/mmzone.h renamed from include/linux/mmzone.h~A3.1-abstract-discontig +11 -0
@@ -11,6 +11,7 @@#include <linux/cache.h> #include <linux/threads.h> #include <linux/numa.h> +#include <linux/init.h> #include <asm/atomic.h> /* Free memory management - zoned buddy allocator. */
@@ -278,6 +279,16 @@ void wakeup_kswapd(struct zone *zone, inint zone_watermark_ok (struct zone *z,int order,unsigned long mark,int alloc_type,int can_try_harder,int gfp_high); +#ifdef CONFIG_HAVE_MEMORY_PRESENT +void memory_present (int nid,unsigned long start,unsigned long end); +#else +static inline void memory_present (int nid,unsigned long start,unsigned long end) {} +#endif + +#ifdef CONFIG_NEED_NODE_MEMMAP_SIZE +unsigned long __init node_memmap_size_bytes (int ,unsigned long ,unsigned long ); +#endif +/* * zone_idx() returns 0 for the ZONE_DMA zone, 1 for the ZONE_NORMAL zone, etc. */
arch/i386/Kconfig renamed from arch/i386/Kconfig~A3.1-abstract-discontig +10 -0
@@ -769,6 +769,16 @@ config HAVE_ARCH_BOOTMEM_NODE depends on NUMA default y +config HAVE_MEMORY_PRESENT + bool + depends on DISCONTIGMEM + default y + +config NEED_NODE_MEMMAP_SIZE + bool + depends on DISCONTIGMEM + default y + config HIGHPTE bool "Allocate 3rd-level pagetables from highmem" depends on HIGHMEM4G || HIGHMEM64G
_
--
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>