linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Zhang Zhen <zhenzhang.zhang@huawei.com>
To: linux-mm@kvack.org
Cc: wangnan0@huawei.com, yinghai@kernel.org
Subject: How to boot up an ARM board enabled CONFIG_SPARSEMEM
Date: Tue, 1 Jul 2014 15:29:40 +0800	[thread overview]
Message-ID: <53B26364.1040606@huawei.com> (raw)
In-Reply-To: <53B26229.5030504@huawei.com>

[-- 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



       reply	other threads:[~2014-07-01  7:30 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <53B26229.5030504@huawei.com>
2014-07-01  7:29 ` Zhang Zhen [this message]
2014-07-01 18:45   ` Yinghai Lu
2014-07-02  6:48     ` Zhang Zhen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=53B26364.1040606@huawei.com \
    --to=zhenzhang.zhang@huawei.com \
    --cc=linux-mm@kvack.org \
    --cc=wangnan0@huawei.com \
    --cc=yinghai@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox