Skip to contentSkip to conversation

How to boot up an ARM board enabled CONFIG_SPARSEMEM

PATCH Zhang Zhen 2 participants 3 messages Jul 1, 2014 – Jul 2, 2014 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

Zhang Zhen

author
#1 lore raw

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!

Quoted 1 line

From c142b3157d4e0f9909076a24b6fe58c60afde0f3 Mon Sep 17 00:00:00 2001

From: Zhang Zhen <[email protected]>
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.

---
 arch/arm/mm/init.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
arch/arm/mm/init.c +17 -0
index 0ecc43f..a36caac 100644
@@ -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
 	}
 
 	/*
Signature · 1 line
1.8.1.2
#2 lore raw
Quoted 4 lines · Zhang Zhen

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?

Quoted 6 lines

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 [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

author
#3 lore raw
Quoted 8 lines · Yinghai Lu
Quoted 4 lines · Zhang Zhen

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.

Quoted 13 lines
Quoted 6 lines

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.

Quoted 8 lines

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!

Quoted 1 line

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