aboutsummaryrefslogtreecommitdiffstats
path: root/arch/i386/mm
diff options
context:
space:
mode:
authorAndy Whitcroft <apw@shadowen.org>2005-06-23 03:07:57 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-06-23 12:45:05 -0400
commit05b79bdcb48c18cd9b580c39e3efb9a1ab078151 (patch)
tree1767aaa7a4621ff4cf1a85c2078229de54272f30 /arch/i386/mm
parentd41dee369bff3b9dcb6328d4d822926c28cc2594 (diff)
[PATCH] sparsemem memory model for i386
Provide the architecture specific implementation for SPARSEMEM for i386 SMP and NUMA systems. Signed-off-by: Andy Whitcroft <apw@shadowen.org> Signed-off-by: Dave Hansen <haveblue@us.ibm.com> Signed-off-by: Martin Bligh <mbligh@aracnet.com> Signed-off-by: Adrian Bunk <bunk@stusta.de> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch/i386/mm')
-rw-r--r--arch/i386/mm/Makefile2
-rw-r--r--arch/i386/mm/discontig.c36
-rw-r--r--arch/i386/mm/init.c18
3 files changed, 30 insertions, 26 deletions
diff --git a/arch/i386/mm/Makefile b/arch/i386/mm/Makefile
index fc3272506846..80908b5aa60f 100644
--- a/arch/i386/mm/Makefile
+++ b/arch/i386/mm/Makefile
@@ -4,7 +4,7 @@
4 4
5obj-y := init.o pgtable.o fault.o ioremap.o extable.o pageattr.o mmap.o 5obj-y := init.o pgtable.o fault.o ioremap.o extable.o pageattr.o mmap.o
6 6
7obj-$(CONFIG_DISCONTIGMEM) += discontig.o 7obj-$(CONFIG_NUMA) += discontig.o
8obj-$(CONFIG_HUGETLB_PAGE) += hugetlbpage.o 8obj-$(CONFIG_HUGETLB_PAGE) += hugetlbpage.o
9obj-$(CONFIG_HIGHMEM) += highmem.o 9obj-$(CONFIG_HIGHMEM) += highmem.o
10obj-$(CONFIG_BOOT_IOREMAP) += boot_ioremap.o 10obj-$(CONFIG_BOOT_IOREMAP) += boot_ioremap.o
diff --git a/arch/i386/mm/discontig.c b/arch/i386/mm/discontig.c
index 088ca4722183..0efeb96ba5d4 100644
--- a/arch/i386/mm/discontig.c
+++ b/arch/i386/mm/discontig.c
@@ -42,12 +42,16 @@ bootmem_data_t node0_bdata;
42 * populated the following initialisation. 42 * populated the following initialisation.
43 * 43 *
44 * 1) node_online_map - the map of all nodes configured (online) in the system 44 * 1) node_online_map - the map of all nodes configured (online) in the system
45 * 2) physnode_map - the mapping between a pfn and owning node 45 * 2) node_start_pfn - the starting page frame number for a node
46 * 3) node_start_pfn - the starting page frame number for a node
47 * 3) node_end_pfn - the ending page fram number for a node 46 * 3) node_end_pfn - the ending page fram number for a node
48 */ 47 */
48unsigned long node_start_pfn[MAX_NUMNODES];
49unsigned long node_end_pfn[MAX_NUMNODES];
50
49 51
52#ifdef CONFIG_DISCONTIGMEM
50/* 53/*
54 * 4) physnode_map - the mapping between a pfn and owning node
51 * physnode_map keeps track of the physical memory layout of a generic 55 * physnode_map keeps track of the physical memory layout of a generic
52 * numa node on a 256Mb break (each element of the array will 56 * numa node on a 256Mb break (each element of the array will
53 * represent 256Mb of memory and will be marked by the node id. so, 57 * represent 256Mb of memory and will be marked by the node id. so,
@@ -85,9 +89,7 @@ unsigned long node_memmap_size_bytes(int nid, unsigned long start_pfn,
85 89
86 return (nr_pages + 1) * sizeof(struct page); 90 return (nr_pages + 1) * sizeof(struct page);
87} 91}
88 92#endif
89unsigned long node_start_pfn[MAX_NUMNODES];
90unsigned long node_end_pfn[MAX_NUMNODES];
91 93
92extern unsigned long find_max_low_pfn(void); 94extern unsigned long find_max_low_pfn(void);
93extern void find_max_pfn(void); 95extern void find_max_pfn(void);
@@ -390,24 +392,26 @@ void __init set_highmem_pages_init(int bad_ppro)
390{ 392{
391#ifdef CONFIG_HIGHMEM 393#ifdef CONFIG_HIGHMEM
392 struct zone *zone; 394 struct zone *zone;
395 struct page *page;
393 396
394 for_each_zone(zone) { 397 for_each_zone(zone) {
395 unsigned long node_pfn, node_high_size, zone_start_pfn; 398 unsigned long node_pfn, zone_start_pfn, zone_end_pfn;
396 struct page * zone_mem_map; 399
397
398 if (!is_highmem(zone)) 400 if (!is_highmem(zone))
399 continue; 401 continue;
400 402
401 printk("Initializing %s for node %d\n", zone->name,
402 zone->zone_pgdat->node_id);
403
404 node_high_size = zone->spanned_pages;
405 zone_mem_map = zone->zone_mem_map;
406 zone_start_pfn = zone->zone_start_pfn; 403 zone_start_pfn = zone->zone_start_pfn;
404 zone_end_pfn = zone_start_pfn + zone->spanned_pages;
405
406 printk("Initializing %s for node %d (%08lx:%08lx)\n",
407 zone->name, zone->zone_pgdat->node_id,
408 zone_start_pfn, zone_end_pfn);
407 409
408 for (node_pfn = 0; node_pfn < node_high_size; node_pfn++) { 410 for (node_pfn = zone_start_pfn; node_pfn < zone_end_pfn; node_pfn++) {
409 one_highpage_init((struct page *)(zone_mem_map + node_pfn), 411 if (!pfn_valid(node_pfn))
410 zone_start_pfn + node_pfn, bad_ppro); 412 continue;
413 page = pfn_to_page(node_pfn);
414 one_highpage_init(page, node_pfn, bad_ppro);
411 } 415 }
412 } 416 }
413 totalram_pages += totalhigh_pages; 417 totalram_pages += totalhigh_pages;
diff --git a/arch/i386/mm/init.c b/arch/i386/mm/init.c
index 666ca79fb50a..48ebfab77a3c 100644
--- a/arch/i386/mm/init.c
+++ b/arch/i386/mm/init.c
@@ -276,7 +276,9 @@ void __init one_highpage_init(struct page *page, int pfn, int bad_ppro)
276 SetPageReserved(page); 276 SetPageReserved(page);
277} 277}
278 278
279#ifndef CONFIG_DISCONTIGMEM 279#ifdef CONFIG_NUMA
280extern void set_highmem_pages_init(int);
281#else
280static void __init set_highmem_pages_init(int bad_ppro) 282static void __init set_highmem_pages_init(int bad_ppro)
281{ 283{
282 int pfn; 284 int pfn;
@@ -284,9 +286,7 @@ static void __init set_highmem_pages_init(int bad_ppro)
284 one_highpage_init(pfn_to_page(pfn), pfn, bad_ppro); 286 one_highpage_init(pfn_to_page(pfn), pfn, bad_ppro);
285 totalram_pages += totalhigh_pages; 287 totalram_pages += totalhigh_pages;
286} 288}
287#else 289#endif /* CONFIG_FLATMEM */
288extern void set_highmem_pages_init(int);
289#endif /* !CONFIG_DISCONTIGMEM */
290 290
291#else 291#else
292#define kmap_init() do { } while (0) 292#define kmap_init() do { } while (0)
@@ -297,10 +297,10 @@ extern void set_highmem_pages_init(int);
297unsigned long long __PAGE_KERNEL = _PAGE_KERNEL; 297unsigned long long __PAGE_KERNEL = _PAGE_KERNEL;
298unsigned long long __PAGE_KERNEL_EXEC = _PAGE_KERNEL_EXEC; 298unsigned long long __PAGE_KERNEL_EXEC = _PAGE_KERNEL_EXEC;
299 299
300#ifndef CONFIG_DISCONTIGMEM 300#ifdef CONFIG_NUMA
301#define remap_numa_kva() do {} while (0)
302#else
303extern void __init remap_numa_kva(void); 301extern void __init remap_numa_kva(void);
302#else
303#define remap_numa_kva() do {} while (0)
304#endif 304#endif
305 305
306static void __init pagetable_init (void) 306static void __init pagetable_init (void)
@@ -525,7 +525,7 @@ static void __init set_max_mapnr_init(void)
525#else 525#else
526 num_physpages = max_low_pfn; 526 num_physpages = max_low_pfn;
527#endif 527#endif
528#ifndef CONFIG_DISCONTIGMEM 528#ifdef CONFIG_FLATMEM
529 max_mapnr = num_physpages; 529 max_mapnr = num_physpages;
530#endif 530#endif
531} 531}
@@ -539,7 +539,7 @@ void __init mem_init(void)
539 int tmp; 539 int tmp;
540 int bad_ppro; 540 int bad_ppro;
541 541
542#ifndef CONFIG_DISCONTIGMEM 542#ifdef CONFIG_FLATMEM
543 if (!mem_map) 543 if (!mem_map)
544 BUG(); 544 BUG();
545#endif 545#endif