From: Akira Takeuchi <takeuchi.akr@jp.panasonic.com>
To: linux-mm@kvack.org
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH RESEND][BUG] sparsemem: Initialize all memmap entries within sections
Date: Fri, 13 Apr 2012 17:53:42 +0900 [thread overview]
Message-ID: <20120413175342.FCE9.38390934@jp.panasonic.com> (raw)
This commit fixes the problem for the kernel
with CONFIG_SPARSEMEM=y and CONFIG_HAVE_ARCH_PFN_VALID=y.
VM subsystem insists that memmap entries within the align to MAX_ORDER_NR_PAGES
must exist and be initialized.
However, in the kernel with CONFIG_SPARSEMEM=y and CONFIG_HAVE_ARCH_PFN_VALID=y,
the kernel only initializes the entries corresponding to the memory regions
specified by "mem=" options. This causes "kernel BUG at mm/page_alloc.c:777!"
This BUG message comes from the following BUG_ON() line in move_freepages().
BUG_ON(page_zone(start_page) != page_zone(end_page));
Signed-off-by: Akira Takeuchi <takeuchi.akr@jp.panasonic.com>
Signed-off-by: Kiyoshi Owada <owada.kiyoshi@jp.panasonic.com>
---
include/linux/mmzone.h | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
index dff7115..1b7538c 100644
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -1088,13 +1088,15 @@ static inline struct mem_section *__pfn_to_section(unsigned long pfn)
return __nr_to_section(pfn_to_section_nr(pfn));
}
-#ifndef CONFIG_HAVE_ARCH_PFN_VALID
-static inline int pfn_valid(unsigned long pfn)
+static inline int sparsemem_pfn_valid(unsigned long pfn)
{
if (pfn_to_section_nr(pfn) >= NR_MEM_SECTIONS)
return 0;
return valid_section(__nr_to_section(pfn_to_section_nr(pfn)));
}
+
+#ifndef CONFIG_HAVE_ARCH_PFN_VALID
+#define pfn_valid(pfn) sparsemem_pfn_valid(pfn)
#endif
static inline int pfn_present(unsigned long pfn)
@@ -1119,7 +1121,7 @@ static inline int pfn_present(unsigned long pfn)
#define pfn_to_nid(pfn) (0)
#endif
-#define early_pfn_valid(pfn) pfn_valid(pfn)
+#define early_pfn_valid(pfn) sparsemem_pfn_valid(pfn)
void sparse_init(void);
#else
#define sparse_init() do {} while (0)
--
1.7.4.1
--
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/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
reply other threads:[~2012-04-13 8:52 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20120413175342.FCE9.38390934@jp.panasonic.com \
--to=takeuchi.akr@jp.panasonic.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.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