Commit 766e012a authored by Andrew Morton's avatar Andrew Morton Committed by David S. Miller

[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.
parent 05789ebc
......@@ -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:
......
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