linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* How to boot up an ARM board enabled CONFIG_SPARSEMEM
       [not found] <53B26229.5030504@huawei.com>
@ 2014-07-01  7:29 ` Zhang Zhen
  2014-07-01 18:45   ` Yinghai Lu
  0 siblings, 1 reply; 3+ messages in thread
From: Zhang Zhen @ 2014-07-01  7:29 UTC (permalink / raw)
  To: linux-mm; +Cc: wangnan0, yinghai

[-- Attachment #1: Type: text/plain, Size: 779 bytes --]

Hi,

Recently We are testing stable kernel 3.10 on an ARM board.
It failed to boot if we enabled CONFIG_SPARSEMEM config.

Through the analysis, we found that mem_init() assumes the pages of different
sections are continuous.

But the truth is the pages of different sections are not continuous when
CONFIG_SPARSEMEM is enabled.

So now we have two ways to boot up when we enabled CONFIG_SPARSEMEM on an arm board.

1. In mem_init() and show_mem() compare pfn instead of page just like the patch in attachement.
2. Enable CONFIG_SPARSEMEM_ALLOC_MEM_MAP_TOGETHER when enabled CONFIG_SPARSEMEM.

QUESTION:

I want to know why CONFIG_SPARSEMEM_ALLOC_MEM_MAP_TOGETHER depends on x86_64 ?

Whether we can enable it on an ARM board ?

Or any other better solution ?


Best regards!




[-- Attachment #2: 0001-sparse-mem-compare-pfn-instead-of-page.patch --]
[-- Type: text/plain, Size: 1653 bytes --]

>From c142b3157d4e0f9909076a24b6fe58c60afde0f3 Mon Sep 17 00:00:00 2001
From: Zhang Zhen <zhenzhang.zhang@huawei.com>
Date: Tue, 1 Jul 2014 14:59:19 +0800
Subject: [PATCH] sparse mem: compare pfn instead of page

If CONFIG_SPARSEMEM is enabled, here the pages of different
sections are not continuous.
So we compare pfn instead of page.

Signed-off-by: Zhang Zhen <zhenzhang.zhang@huawei.com>
---
 arch/arm/mm/init.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c
index 0ecc43f..a36caac 100644
--- a/arch/arm/mm/init.c
+++ b/arch/arm/mm/init.c
@@ -115,6 +115,9 @@ void show_mem(unsigned int filter)
 
 		do {
 			total++;
+#if defined(CONFIG_SPARSEMEM) && defined(CONFIG_MACH_HI1380)
+			page = pfn_to_page(pfn1);
+#endif
 			if (PageReserved(page))
 				reserved++;
 			else if (PageSwapCache(page))
@@ -125,8 +128,13 @@ void show_mem(unsigned int filter)
 				free++;
 			else
 				shared += page_count(page) - 1;
+#if defined(CONFIG_SPARSEMEM) && defined(CONFIG_MACH_HI1380)
+			pfn1++;
+		} while (pfn1 < pfn2);
+#else
 			page++;
 		} while (page < end);
+#endif
 	}
 
 	printk("%d pages of RAM\n", total);
@@ -619,12 +627,21 @@ void __init mem_init(void)
 		end  = pfn_to_page(pfn2 - 1) + 1;
 
 		do {
+#if defined(CONFIG_SPARSEMEM) && defined(CONFIG_MACH_HI1380)
+			page = pfn_to_page(pfn1);
+#endif
 			if (PageReserved(page))
 				reserved_pages++;
 			else if (!page_count(page))
 				free_pages++;
+
+#if defined(CONFIG_SPARSEMEM) && defined(CONFIG_MACH_HI1380)
+			pfn1++;
+		} while (pfn1 < pfn2);
+#else
 			page++;
 		} while (page < end);
+#endif
 	}
 
 	/*
-- 
1.8.1.2



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: How to boot up an ARM board enabled CONFIG_SPARSEMEM
  2014-07-01  7:29 ` How to boot up an ARM board enabled CONFIG_SPARSEMEM Zhang Zhen
@ 2014-07-01 18:45   ` Yinghai Lu
  2014-07-02  6:48     ` Zhang Zhen
  0 siblings, 1 reply; 3+ messages in thread
From: Yinghai Lu @ 2014-07-01 18:45 UTC (permalink / raw)
  To: Zhang Zhen; +Cc: Linux MM, wangnan0

On Tue, Jul 1, 2014 at 12:29 AM, Zhang Zhen <zhenzhang.zhang@huawei.com> wrote:
> Hi,
>
> Recently We are testing stable kernel 3.10 on an ARM board.
> It failed to boot if we enabled CONFIG_SPARSEMEM config.

Arm support 2 sockets and numa now?

> 1. In mem_init() and show_mem() compare pfn instead of page just like the patch in attachement.
> 2. Enable CONFIG_SPARSEMEM_ALLOC_MEM_MAP_TOGETHER when enabled CONFIG_SPARSEMEM.
>
> QUESTION:
>
> I want to know why CONFIG_SPARSEMEM_ALLOC_MEM_MAP_TOGETHER depends on x86_64 ?

That make memory allocation have less memory hole, from old bootmem bitmap
allocation stage.

Maybe we don't need that anymore as we have memblock allocation that is more
smarter with alignment handling.

Also allocating big size and use them block by block, could save some time on
searching on allocation function when memblock have lots of entries on
memory/reserved arrays.

Thanks

Yinghai

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: How to boot up an ARM board enabled CONFIG_SPARSEMEM
  2014-07-01 18:45   ` Yinghai Lu
@ 2014-07-02  6:48     ` Zhang Zhen
  0 siblings, 0 replies; 3+ messages in thread
From: Zhang Zhen @ 2014-07-02  6:48 UTC (permalink / raw)
  To: Yinghai Lu; +Cc: Linux MM, wangnan0

On 2014/7/2 2:45, Yinghai Lu wrote:
> On Tue, Jul 1, 2014 at 12:29 AM, Zhang Zhen <zhenzhang.zhang@huawei.com> wrote:
>> Hi,
>>
>> Recently We are testing stable kernel 3.10 on an ARM board.
>> It failed to boot if we enabled CONFIG_SPARSEMEM config.
> 
> Arm support 2 sockets and numa now?
> 
ARM doesn't support numa until now. We have added memory hotplug feature on ARM arch.
So we need to enable CONFIG_SPARSEMEM.

>> 1. In mem_init() and show_mem() compare pfn instead of page just like the patch in attachement.
>> 2. Enable CONFIG_SPARSEMEM_ALLOC_MEM_MAP_TOGETHER when enabled CONFIG_SPARSEMEM.
>>
>> QUESTION:
>>
>> I want to know why CONFIG_SPARSEMEM_ALLOC_MEM_MAP_TOGETHER depends on x86_64 ?
> 
> That make memory allocation have less memory hole, from old bootmem bitmap
> allocation stage.
> 
> Maybe we don't need that anymore as we have memblock allocation that is more
> smarter with alignment handling.
> 
> Also allocating big size and use them block by block, could save some time on
> searching on allocation function when memblock have lots of entries on
> memory/reserved arrays.
> 
> Thanks
> 
> Yinghai
> 
Hi, Yinghai

Have you seen my patch ?
If we enabled CONFIG_SPARSEMEM here in the patch need to enable CONFIG_SPARSEMEM_ALLOC_MEM_MAP_TOGETHER to
guarantee the pages of different sections are continuous.

So in my opinion, CONFIG_SPARSEMEM_ALLOC_MEM_MAP_TOGETHER doesn't need to depend on x86_64, which helps futher
coding.

If i'm wrong, please let me know !

Thanks for your comments!

> 


--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-07-02  6:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <53B26229.5030504@huawei.com>
2014-07-01  7:29 ` How to boot up an ARM board enabled CONFIG_SPARSEMEM Zhang Zhen
2014-07-01 18:45   ` Yinghai Lu
2014-07-02  6:48     ` Zhang Zhen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).