From 6f284a2ce7b8bc49cb8455b1763357897a899abb Mon Sep 17 00:00:00 2001 From: Franck Bui-Huu Date: Wed, 10 Jan 2007 09:44:05 +0100 Subject: [MIPS] FLATMEM: introduce PHYS_OFFSET. The old code was assuming that min_low_pfn was always 0. This means that platforms having a big hole at their memory start paid the price of wasting some memory for the allocation of unused entries in mem_map[]. This patch prevents this waste. It introduces PHYS_OFFSET define which is the start of the physical memory and uses it wherever needed. Specially when converting physical/virtual addresses into virtual/physical ones. Currently all platforms defines PHYS_OFFSET to 0. Signed-off-by: Franck Bui-Huu Signed-off-by: Ralf Baechle --- arch/mips/kernel/setup.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'arch/mips/kernel/setup.c') diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c index f352cd9c834..e1d76b87601 100644 --- a/arch/mips/kernel/setup.c +++ b/arch/mips/kernel/setup.c @@ -315,13 +315,17 @@ static void __init bootmem_init(void) if (min_low_pfn >= max_low_pfn) panic("Incorrect memory mapping !!!"); - if (min_low_pfn > 0) { + if (min_low_pfn > ARCH_PFN_OFFSET) { printk(KERN_INFO "Wasting %lu bytes for tracking %lu unused pages\n", - min_low_pfn * sizeof(struct page), - min_low_pfn); - min_low_pfn = 0; + (min_low_pfn - ARCH_PFN_OFFSET) * sizeof(struct page), + min_low_pfn - ARCH_PFN_OFFSET); + } else if (min_low_pfn < ARCH_PFN_OFFSET) { + printk(KERN_INFO + "%lu free pages won't be used\n", + ARCH_PFN_OFFSET - min_low_pfn); } + min_low_pfn = ARCH_PFN_OFFSET; /* * Determine low and high memory ranges -- cgit v1.2.3