sparsemem base: early_pfn_to_nid() (works before sparse is initialized)
PATCH 4/4 sparsemem base: early_pfn_to_nid() (works before sparse is initialized)
We _know_ which node pages in general belong to, at least at a very gross level in node_{start,end}_pfn[]. Use those to target the allocations of pages.
Signed-off-by Andy Whitcroft <[email protected]>
Signed-off-by Dave Hansen <[email protected]>
---
arch/ia64/mm/numa.c | 0 memhotplug-dave/arch/i386/mm/discontig.c | 15 +++++++++++++++ 2 files changed, 15 insertions(+)
arch/i386/mm/discontig.c renamed from arch/i386/mm/discontig.c~B-sparse-130-add-early_pfn_to_nid +15 -0
@@ -149,6 +149,21 @@ static void __init find_max_pfn_node(intBUG (); } +/* Find the owning node for a pfn. */ +int early_pfn_to_nid (unsigned long pfn) +{ +int nid; + +for_each_node (nid) { +if (node_end_pfn[nid] ==0 ) +break ; +if (node_start_pfn[nid] <= pfn && node_end_pfn[nid] >= pfn) +return nid; + } + +return 0 ; +} +/* * Allocate memory for the pg_data_t for this node via a crude pre-bootmem * method. For node zero take this from the bottom of memory, for
diff -puN arch/ppc64/mm/numa.c~B-sparse-130-add-early_pfn_to_nid arch/ppc64/mm/numa.c diff -puN arch/ia64/mm/numa.c~B-sparse-130-add-early_pfn_to_nid arch/ia64/mm/numa.c _
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>