mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] x86: remove wrong -1 in calling init_memory_mapping
@ 2008-10-27 20:03 Yinghai Lu
  2008-10-28  8:42 ` Ingo Molnar
  0 siblings, 1 reply; 2+ messages in thread
From: Yinghai Lu @ 2008-10-27 20:03 UTC (permalink / raw)
  To: Ingo Molnar, Thomas Gleixner, H. Peter Anvin, Andrew Morton, Shaohua Li
  Cc: linux-kernel, Yasunori Goto

From: Shaohua Li <shaohua.li@intel.com>

impact: make memory hot plug got last page mapped.

Shuahua Li found:
Round up address to a page, otherwise the last page isn't mapped.

No, I just did some experiments on a desktop for memory hotplug and this bug
triggered a crash in my test.
Yinghai's suggestion also fixed the bug. I just want to have safer method. Anyway, either approach is ok to me.

So acctually we don't need to round it.
just remove that extra -1

Signed-off-by: Yinghai <yinghai@kernel.org>

diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c
index d59e4c9..2884b17 100644
--- a/arch/x86/mm/init_64.c
+++ b/arch/x86/mm/init_64.c
@@ -837,7 +837,7 @@ int arch_add_memory(int nid, u64 start, u64 size)
 	unsigned long nr_pages = size >> PAGE_SHIFT;
 	int ret;
 
-	last_mapped_pfn = init_memory_mapping(start, start + size-1);
+	last_mapped_pfn = init_memory_mapping(start, start + size);
 	if (last_mapped_pfn > max_pfn_mapped)
 		max_pfn_mapped = last_mapped_pfn;
 

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

end of thread, other threads:[~2008-10-28  8:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-10-27 20:03 [PATCH] x86: remove wrong -1 in calling init_memory_mapping Yinghai Lu
2008-10-28  8:42 ` Ingo Molnar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome