Re: [PATCH] do not count pages in holes with sparsemem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Atsushi Nemoto wrote:
> On Thu, 06 Jul 2006 15:12:11 +0200, Franck Bui-Huu <vagabon.xyz@xxxxxxxxx> wrote:
>> Ok thinking more about it, some platforms may have physical memory
>> that doesn't start at 0. MIPS doesn't support such platform though it
>> should be fairly easy. In that case __pa should be defined as:
>>
>> 	#define __pa(x)	((unsigned long) (x) - PAGE_OFFSET + PFN_PHYS(ARCH_PFN_OFFSET))
>>
>> and use in your patch:
>>
>> 	free_area_init_node(0, NODE_DATA(0), zones_size, ARCH_PFN_OFFSET, zholes_size);
>>
>> So I would recommend to use ARCH_PFN_OFFSET.
> 
> Well, currently ARCH_PFN_OFFSET is defined in
> asm-generic/memory_model.h only for FLATMEM case.  I think other
> memory models do not need it because it is just a case that a first
> hole begins at pfn 0.
> 

That's true, I thought it was defined whatever the mem models...

what about this, on top of your patch ?

-- >8 --

diff --git a/arch/mips/mm/init.c b/arch/mips/mm/init.c
index c6e684d..eb1b3fc 100644
--- a/arch/mips/mm/init.c
+++ b/arch/mips/mm/init.c
@@ -166,8 +166,8 @@ void __init paging_init(void)
 {
 	unsigned long zones_size[] = { [0 ... MAX_NR_ZONES - 1] = 0 };
 	unsigned long max_dma, high, low;
-	unsigned long zholes_size[] = { [0 ... MAX_NR_ZONES - 1] = 0 };
 #ifndef CONFIG_FLATMEM
+	unsigned long zholes_size[] = { [0 ... MAX_NR_ZONES - 1] = 0 };
 	unsigned long i, j, pfn;
 #endif
 
@@ -207,8 +207,10 @@ #ifndef CONFIG_FLATMEM
 		for (j = 0; j < zones_size[i]; j++, pfn++)
 			if (!page_is_ram(pfn))
 				zholes_size[i]++;
-#endif
 	free_area_init_node(0, NODE_DATA(0), zones_size, 0, zholes_size);
+#else
+	free_area_init_node(0, NODE_DATA(0), zones_size, ARCH_PFN_OFFSET, NULL);
+#endif
 }
 
 static struct kcore_list kcore_mem, kcore_vmalloc;


[Index of Archives]     [Linux MIPS Home]     [LKML Archive]     [Linux ARM Kernel]     [Linux ARM]     [Linux]     [Git]     [Yosemite News]     [Linux SCSI]     [Linux Hams]

  Powered by Linux