summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorAndrew Morton <akpm@osdl.org>2004-02-18 16:39:02 -0800
committerDavid S. Miller <davem@nuts.davemloft.net>2004-02-18 16:39:02 -0800
commit766e012ad6da18cd940874bcf3afe38574b8916a (patch)
tree840a25917543af459cb11a56ad8b289024327fcf /include
parent05789ebc3647e48aaa554d1c456935c044d82fb6 (diff)
[PATCH] fix pfn_valid on ia32 discontigmem
From: "Martin J. Bligh" <mbligh@aracnet.com> Fix pfn_valid for architctures with discontiguous memory. This only changes the NUMA definition, and it leaves the NUMA-Q definition as was, because it's faster that way, it's in hotpaths, and our memory is always contiguous.
Diffstat (limited to 'include')
-rw-r--r--include/asm-i386/mmzone.h19
1 files changed, 12 insertions, 7 deletions
diff --git a/include/asm-i386/mmzone.h b/include/asm-i386/mmzone.h
index 1bd79dfb3c9a..b5085a0f664e 100644
--- a/include/asm-i386/mmzone.h
+++ b/include/asm-i386/mmzone.h
@@ -80,14 +80,19 @@ extern struct pglist_data *node_data[];
+ __zone->zone_start_pfn; \
})
#define pmd_page(pmd) (pfn_to_page(pmd_val(pmd) >> PAGE_SHIFT))
-/*
- * pfn_valid should be made as fast as possible, and the current definition
- * is valid for machines that are NUMA, but still contiguous, which is what
- * is currently supported. A more generalised, but slower definition would
- * be something like this - mbligh:
- * ( pfn_to_pgdat(pfn) && ((pfn) < node_end_pfn(pfn_to_nid(pfn))) )
- */
+
+#ifdef CONFIG_X86_NUMAQ /* we have contiguous memory on NUMA-Q */
#define pfn_valid(pfn) ((pfn) < num_physpages)
+#else
+static inline int pfn_valid(int pfn)
+{
+ int nid = pfn_to_nid(pfn);
+
+ if (nid >= 0)
+ return (pfn < node_end_pfn(nid));
+ return 0;
+}
+#endif
/*
* generic node memory support, the following assumptions apply: