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

[PATCH] ia32: pfn_to_nid fix

From: "Martin J. Bligh" <mbligh@aracnet.com>

Makes sure pfn_to_nid is defined for all combinations of subarches, and that
it's defined before it's used so we don't run into implicit declaration
problems.
parent 766e012a
......@@ -10,7 +10,49 @@
#ifdef CONFIG_DISCONTIGMEM
#ifdef CONFIG_NUMA
#ifdef CONFIG_X86_NUMAQ
#include <asm/numaq.h>
#else /* summit or generic arch */
#include <asm/srat.h>
#endif
#else /* !CONFIG_NUMA */
#define get_memcfg_numa get_memcfg_numa_flat
#define get_zholes_size(n) (0)
#endif /* CONFIG_NUMA */
extern struct pglist_data *node_data[];
#define NODE_DATA(nid) (node_data[nid])
/*
* generic node memory support, the following assumptions apply:
*
* 1) memory comes in 256Mb contigious chunks which are either present or not
* 2) we will not have more than 64Gb in total
*
* for now assume that 64Gb is max amount of RAM for whole system
* 64Gb / 4096bytes/page = 16777216 pages
*/
#define MAX_NR_PAGES 16777216
#define MAX_ELEMENTS 256
#define PAGES_PER_ELEMENT (MAX_NR_PAGES/MAX_ELEMENTS)
extern u8 physnode_map[];
static inline int pfn_to_nid(unsigned long pfn)
{
#ifdef CONFIG_NUMA
return(physnode_map[(pfn) / PAGES_PER_ELEMENT]);
#else
return 0;
#endif
}
static inline struct pglist_data *pfn_to_pgdat(unsigned long pfn)
{
return(NODE_DATA(pfn_to_nid(pfn)));
}
/*
* Following are macros that are specific to this numa platform.
......@@ -43,11 +85,6 @@ extern struct pglist_data *node_data[];
*/
#define kvaddr_to_nid(kaddr) pfn_to_nid(__pa(kaddr) >> PAGE_SHIFT)
/*
* Return a pointer to the node data for node n.
*/
#define NODE_DATA(nid) (node_data[nid])
#define node_mem_map(nid) (NODE_DATA(nid)->node_mem_map)
#define node_start_pfn(nid) (NODE_DATA(nid)->node_start_pfn)
#define node_end_pfn(nid) \
......@@ -94,40 +131,6 @@ static inline int pfn_valid(int pfn)
}
#endif
/*
* generic node memory support, the following assumptions apply:
*
* 1) memory comes in 256Mb contigious chunks which are either present or not
* 2) we will not have more than 64Gb in total
*
* for now assume that 64Gb is max amount of RAM for whole system
* 64Gb / 4096bytes/page = 16777216 pages
*/
#define MAX_NR_PAGES 16777216
#define MAX_ELEMENTS 256
#define PAGES_PER_ELEMENT (MAX_NR_PAGES/MAX_ELEMENTS)
extern u8 physnode_map[];
static inline int pfn_to_nid(unsigned long pfn)
{
return(physnode_map[(pfn) / PAGES_PER_ELEMENT]);
}
static inline struct pglist_data *pfn_to_pgdat(unsigned long pfn)
{
return(NODE_DATA(pfn_to_nid(pfn)));
}
#ifdef CONFIG_X86_NUMAQ
#include <asm/numaq.h>
#elif CONFIG_ACPI_SRAT
#include <asm/srat.h>
#elif CONFIG_X86_PC
#define get_zholes_size(n) (0)
#else
#define pfn_to_nid(pfn) (0)
#endif /* CONFIG_X86_NUMAQ */
extern int get_memcfg_numa_flat(void );
/*
* This allows any one NUMA architecture to be compiled
......
......@@ -304,6 +304,7 @@ extern struct pglist_data contig_page_data;
#define NODE_DATA(nid) (&contig_page_data)
#define NODE_MEM_MAP(nid) mem_map
#define MAX_NODES_SHIFT 1
#define pfn_to_nid(pfn) (0)
#else /* CONFIG_DISCONTIGMEM */
......
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