Commit cc2559bc authored by KAMEZAWA Hiroyuki's avatar KAMEZAWA Hiroyuki Committed by Linus Torvalds

mm: fix memmap init for handling memory hole

Now, early_pfn_in_nid(PFN, NID) may returns false if PFN is a hole.
and memmap initialization was not done. This was a trouble for
sparc boot.

To fix this, the PFN should be initialized and marked as PG_reserved.
This patch changes early_pfn_in_nid() return true if PFN is a hole.
Signed-off-by: default avatarKAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Reported-by: default avatarDavid Miller <davem@davemlloft.net>
Tested-by: default avatarKOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Cc: Mel Gorman <mel@csn.ul.ie>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: <stable@kernel.org>		[2.6.25.x, 2.6.26.x, 2.6.27.x, 2.6.28.x]
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent f2dbcfa7
...@@ -70,7 +70,7 @@ int __meminit __early_pfn_to_nid(unsigned long pfn) ...@@ -70,7 +70,7 @@ int __meminit __early_pfn_to_nid(unsigned long pfn)
return node_memblk[i].nid; return node_memblk[i].nid;
} }
return 0; return -1;
} }
#ifdef CONFIG_MEMORY_HOTPLUG #ifdef CONFIG_MEMORY_HOTPLUG
......
...@@ -1071,7 +1071,7 @@ void sparse_init(void); ...@@ -1071,7 +1071,7 @@ void sparse_init(void);
#endif /* CONFIG_SPARSEMEM */ #endif /* CONFIG_SPARSEMEM */
#ifdef CONFIG_NODES_SPAN_OTHER_NODES #ifdef CONFIG_NODES_SPAN_OTHER_NODES
#define early_pfn_in_nid(pfn, nid) (early_pfn_to_nid(pfn) == (nid)) bool early_pfn_in_nid(unsigned long pfn, int nid);
#else #else
#define early_pfn_in_nid(pfn, nid) (1) #define early_pfn_in_nid(pfn, nid) (1)
#endif #endif
......
...@@ -3000,16 +3000,33 @@ int __meminit __early_pfn_to_nid(unsigned long pfn) ...@@ -3000,16 +3000,33 @@ int __meminit __early_pfn_to_nid(unsigned long pfn)
if (start_pfn <= pfn && pfn < end_pfn) if (start_pfn <= pfn && pfn < end_pfn)
return early_node_map[i].nid; return early_node_map[i].nid;
} }
/* This is a memory hole */
return 0; return -1;
} }
#endif /* CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID */ #endif /* CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID */
int __meminit early_pfn_to_nid(unsigned long pfn) int __meminit early_pfn_to_nid(unsigned long pfn)
{ {
return __early_pfn_to_nid(pfn); int nid;
nid = __early_pfn_to_nid(pfn);
if (nid >= 0)
return nid;
/* just returns 0 */
return 0;
} }
#ifdef CONFIG_NODES_SPAN_OTHER_NODES
bool __meminit early_pfn_in_nid(unsigned long pfn, int node)
{
int nid;
nid = __early_pfn_to_nid(pfn);
if (nid >= 0 && nid != node)
return false;
return true;
}
#endif
/* Basic iterator support to walk early_node_map[] */ /* Basic iterator support to walk early_node_map[] */
#define for_each_active_range_index_in_nid(i, nid) \ #define for_each_active_range_index_in_nid(i, nid) \
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment