aboutsummaryrefslogtreecommitdiff
path: root/arch/ia64/mm/numa.c
diff options
context:
space:
mode:
authorGravatar Linus Torvalds <torvalds@g5.osdl.org> 2005-10-28 21:09:26 -0700
committerGravatar Linus Torvalds <torvalds@g5.osdl.org> 2005-10-28 21:09:26 -0700
commit8a212ab6b8a4ccc6f3c3d1beba5f92655c576404 (patch)
tree525271129ff9c692defdd20566f1f7203b18ff24 /arch/ia64/mm/numa.c
parentMerge master.kernel.org:/pub/scm/linux/kernel/git/gregkh/usb-2.6 (diff)
parent[IA64] fix warning unused variable `g' (diff)
downloadlinux-8a212ab6b8a4ccc6f3c3d1beba5f92655c576404.tar.gz
linux-8a212ab6b8a4ccc6f3c3d1beba5f92655c576404.tar.bz2
linux-8a212ab6b8a4ccc6f3c3d1beba5f92655c576404.zip
Merge branch 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/aegl/linux-2.6
Diffstat (limited to 'arch/ia64/mm/numa.c')
-rw-r--r--arch/ia64/mm/numa.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/arch/ia64/mm/numa.c b/arch/ia64/mm/numa.c
index 77118bbf3d8b..4e5c8b36ad93 100644
--- a/arch/ia64/mm/numa.c
+++ b/arch/ia64/mm/numa.c
@@ -47,3 +47,27 @@ paddr_to_nid(unsigned long paddr)
return (i < num_node_memblks) ? node_memblk[i].nid : (num_node_memblks ? -1 : 0);
}
+
+#if defined(CONFIG_SPARSEMEM) && defined(CONFIG_NUMA)
+/*
+ * Because of holes evaluate on section limits.
+ * If the section of memory exists, then return the node where the section
+ * resides. Otherwise return node 0 as the default. This is used by
+ * SPARSEMEM to allocate the SPARSEMEM sectionmap on the NUMA node where
+ * the section resides.
+ */
+int early_pfn_to_nid(unsigned long pfn)
+{
+ int i, section = pfn >> PFN_SECTION_SHIFT, ssec, esec;
+
+ for (i = 0; i < num_node_memblks; i++) {
+ ssec = node_memblk[i].start_paddr >> PA_SECTION_SHIFT;
+ esec = (node_memblk[i].start_paddr + node_memblk[i].size +
+ ((1L << PA_SECTION_SHIFT) - 1)) >> PA_SECTION_SHIFT;
+ if (section >= ssec && section < esec)
+ return node_memblk[i].nid;
+ }
+
+ return 0;
+}
+#endif