Commit 31d71284 authored by Anton Blanchard's avatar Anton Blanchard

ppc64: DISCONTIGMEM updates

parent 657732b7
...@@ -99,23 +99,26 @@ mmu_gather_t mmu_gathers[NR_CPUS]; ...@@ -99,23 +99,26 @@ mmu_gather_t mmu_gathers[NR_CPUS];
void show_mem(void) void show_mem(void)
{ {
int pfn, total = 0, reserved = 0; int total = 0, reserved = 0;
int shared = 0, cached = 0; int shared = 0, cached = 0;
struct page *page; struct page *page;
pg_data_t *pgdat;
unsigned long i;
printk("Mem-info:\n"); printk("Mem-info:\n");
show_free_areas(); show_free_areas();
printk("Free swap: %6dkB\n",nr_swap_pages<<(PAGE_SHIFT-10)); printk("Free swap: %6dkB\n",nr_swap_pages<<(PAGE_SHIFT-10));
pfn = max_mapnr; for_each_pgdat(pgdat) {
while (pfn-- > 0) { for (i = 0; i < pgdat->node_size; i++) {
page = pfn_to_page(pfn); page = pgdat->node_mem_map + i;
total++; total++;
if (PageReserved(page)) if (PageReserved(page))
reserved++; reserved++;
else if (PageSwapCache(page)) else if (PageSwapCache(page))
cached++; cached++;
else if (page_count(page)) else if (page_count(page))
shared += page_count(page) - 1; shared += page_count(page) - 1;
}
} }
printk("%d pages of RAM\n",total); printk("%d pages of RAM\n",total);
printk("%d reserved pages\n",reserved); printk("%d reserved pages\n",reserved);
...@@ -511,9 +514,8 @@ void __init mem_init(void) ...@@ -511,9 +514,8 @@ void __init mem_init(void)
int datapages = 0; int datapages = 0;
int initpages = 0; int initpages = 0;
max_mapnr = max_low_pfn; num_physpages = max_low_pfn; /* RAM is assumed contiguous */
high_memory = (void *) __va(max_low_pfn * PAGE_SIZE); high_memory = (void *) __va(max_low_pfn * PAGE_SIZE);
num_physpages = max_mapnr; /* RAM is assumed contiguous */
max_pfn = max_low_pfn; max_pfn = max_low_pfn;
#ifdef CONFIG_DISCONTIGMEM #ifdef CONFIG_DISCONTIGMEM
...@@ -535,6 +537,8 @@ void __init mem_init(void) ...@@ -535,6 +537,8 @@ void __init mem_init(void)
PAGE_OFFSET, (unsigned long)__va(lmb_end_of_DRAM())); PAGE_OFFSET, (unsigned long)__va(lmb_end_of_DRAM()));
} }
#else #else
max_mapnr = num_physpages;
totalram_pages += free_all_bootmem(); totalram_pages += free_all_bootmem();
if ( sysmap_size ) if ( sysmap_size )
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#define _ASM_MMZONE_H_ #define _ASM_MMZONE_H_
#include <linux/config.h> #include <linux/config.h>
#include <asm/smp.h>
#ifdef CONFIG_DISCONTIGMEM #ifdef CONFIG_DISCONTIGMEM
...@@ -21,7 +22,6 @@ extern int numa_node_exists[]; ...@@ -21,7 +22,6 @@ extern int numa_node_exists[];
extern int numa_cpu_lookup_table[]; extern int numa_cpu_lookup_table[];
extern int numa_memory_lookup_table[]; extern int numa_memory_lookup_table[];
#define MAX_NUMNODES 16
#define MAX_MEMORY (1UL << 41) #define MAX_MEMORY (1UL << 41)
/* 256MB regions */ /* 256MB regions */
#define MEMORY_INCREMENT_SHIFT 28 #define MEMORY_INCREMENT_SHIFT 28
...@@ -112,5 +112,8 @@ static inline int __cpu_to_node(int cpu) ...@@ -112,5 +112,8 @@ static inline int __cpu_to_node(int cpu)
page_zone(__tmp)->zone_start_pfn); \ page_zone(__tmp)->zone_start_pfn); \
}) })
/* XXX fix for discontiguous physical memory */
#define discontigmem_pfn_valid(pfn) ((pfn) < num_physpages)
#endif /* CONFIG_DISCONTIGMEM */ #endif /* CONFIG_DISCONTIGMEM */
#endif /* _ASM_MMZONE_H_ */ #endif /* _ASM_MMZONE_H_ */
#ifndef _ASM_MAX_NUMNODES_H
#define _ASM_MAX_NUMNODES_H
#define MAX_NUMNODES 16
#endif /* _ASM_MAX_NUMNODES_H */
...@@ -207,13 +207,15 @@ static inline int get_order(unsigned long size) ...@@ -207,13 +207,15 @@ static inline int get_order(unsigned long size)
#ifdef CONFIG_DISCONTIGMEM #ifdef CONFIG_DISCONTIGMEM
#define page_to_pfn(page) discontigmem_page_to_pfn(page) #define page_to_pfn(page) discontigmem_page_to_pfn(page)
#define pfn_to_page(pfn) discontigmem_pfn_to_page(pfn) #define pfn_to_page(pfn) discontigmem_pfn_to_page(pfn)
#define pfn_valid(pfn) discontigmem_pfn_valid(pfn)
#else #else
#define pfn_to_page(pfn) (mem_map + (pfn)) #define pfn_to_page(pfn) (mem_map + (pfn))
#define page_to_pfn(page) ((unsigned long)((page) - mem_map)) #define page_to_pfn(page) ((unsigned long)((page) - mem_map))
#define pfn_valid(pfn) ((pfn) < max_mapnr)
#endif #endif
#define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT) #define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT)
#define pfn_valid(pfn) ((pfn) < max_mapnr)
#define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT) #define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT)
#define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \ #define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \
......
...@@ -35,12 +35,7 @@ ...@@ -35,12 +35,7 @@
#define PTRS_PER_PMD (1 << PMD_INDEX_SIZE) #define PTRS_PER_PMD (1 << PMD_INDEX_SIZE)
#define PTRS_PER_PGD (1 << PGD_INDEX_SIZE) #define PTRS_PER_PGD (1 << PGD_INDEX_SIZE)
#if 0 #define USER_PTRS_PER_PGD (TASK_SIZE_USER64 / PGDIR_SIZE)
/* DRENG / PPPBBB This is a compiler bug!!! */
#define USER_PTRS_PER_PGD (TASK_SIZE / PGDIR_SIZE)
#else
#define USER_PTRS_PER_PGD (1024)
#endif
#define FIRST_USER_PGD_NR 0 #define FIRST_USER_PGD_NR 0
#define EADDR_SIZE (PTE_INDEX_SIZE + PMD_INDEX_SIZE + \ #define EADDR_SIZE (PTE_INDEX_SIZE + PMD_INDEX_SIZE + \
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment