On Fri, 28 Mar 2008 10:34:51 +0900
Yasunori Goto <y-goto@xxxxxxxxxxxxxx> wrote:
Ah, ok. sorry.Both Nack.diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.cWhy just WARNING ? not BUG_ON?
--- a/mm/memory_hotplug.c
+++ b/mm/memory_hotplug.c
@@ -300,6 +300,11 @@
int ret;
u64 start = res->start;
u64 size = res->end - res->start + 1;
+
+ /* Adding non-section-aligned memory will give unexpected
+ and unintuitive results. */
+ WARN_ON((start & SECTION_SIZE_MASK) != 0);
+ WARN_ON((size & SECTION_SIZE_MASK) != 0);
Because, firmware may occupy some area in the section.
Firmware must exclude those area to notify kernel. So, E820, EFI,
or _CRS of ACPI may return not aligned address and size.
register_memory_resource() and walk_memory_resource() are to skip
them silently. This is intended.
Jeremy, I think you can check whether you have 'struct page' or not by
pfn_valid().
If pfn_valid() == false, you should call add_memory() and create
a section/mem_map. If pfn_valid() == true, you should just remove
PG_reserved bit in mem_map by online_page().