Commit 1c050f9d authored by Martin J. Bligh's avatar Martin J. Bligh Committed by Linus Torvalds

[PATCH] Move pfn_to_nid inline

Patch from William Lee Irwin

Inline and simplify pfn_to_nid - this is called heavily, it's a tiny
function, and makes a noticable difference in system time for kernel
compiles (sorry, lost the data). Is only used on NUMA machines.

Has been tested in my tree for over a month on UP, SMP, and NUMA and
compile tested against a variety of different configs.
parent 35bff081
...@@ -68,7 +68,6 @@ EXPORT_SYMBOL(EISA_bus); ...@@ -68,7 +68,6 @@ EXPORT_SYMBOL(EISA_bus);
EXPORT_SYMBOL(MCA_bus); EXPORT_SYMBOL(MCA_bus);
#ifdef CONFIG_DISCONTIGMEM #ifdef CONFIG_DISCONTIGMEM
EXPORT_SYMBOL(node_data); EXPORT_SYMBOL(node_data);
EXPORT_SYMBOL(pfn_to_nid);
#endif #endif
#ifdef CONFIG_X86_NUMAQ #ifdef CONFIG_X86_NUMAQ
EXPORT_SYMBOL(xquad_portio); EXPORT_SYMBOL(xquad_portio);
......
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#include <linux/mm.h> #include <linux/mm.h>
#include <linux/bootmem.h> #include <linux/bootmem.h>
#include <linux/mmzone.h> #include <linux/mmzone.h>
#include <linux/module.h>
#include <asm/numaq.h> #include <asm/numaq.h>
/* These are needed before the pgdat's are created */ /* These are needed before the pgdat's are created */
...@@ -82,19 +83,7 @@ static void __init smp_dump_qct(void) ...@@ -82,19 +83,7 @@ static void __init smp_dump_qct(void)
* physnode_map[8- ] = -1; * physnode_map[8- ] = -1;
*/ */
int physnode_map[MAX_ELEMENTS] = { [0 ... (MAX_ELEMENTS - 1)] = -1}; int physnode_map[MAX_ELEMENTS] = { [0 ... (MAX_ELEMENTS - 1)] = -1};
EXPORT_SYMBOL(physnode_map);
#define PFN_TO_ELEMENT(pfn) (pfn / PAGES_PER_ELEMENT)
#define PA_TO_ELEMENT(pa) (PFN_TO_ELEMENT(pa >> PAGE_SHIFT))
int pfn_to_nid(unsigned long pfn)
{
int nid = physnode_map[PFN_TO_ELEMENT(pfn)];
if (nid == -1)
BUG(); /* address is not present */
return nid;
}
/* /*
* for each node mark the regions * for each node mark the regions
......
...@@ -36,10 +36,11 @@ ...@@ -36,10 +36,11 @@
#define MAX_ELEMENTS 256 #define MAX_ELEMENTS 256
#define PAGES_PER_ELEMENT (16777216/256) #define PAGES_PER_ELEMENT (16777216/256)
extern int physnode_map[];
#define pfn_to_nid(pfn) ({ physnode_map[(pfn) / PAGES_PER_ELEMENT]; })
#define pfn_to_pgdat(pfn) NODE_DATA(pfn_to_nid(pfn)) #define pfn_to_pgdat(pfn) NODE_DATA(pfn_to_nid(pfn))
#define PHYSADDR_TO_NID(pa) pfn_to_nid(pa >> PAGE_SHIFT) #define PHYSADDR_TO_NID(pa) pfn_to_nid(pa >> PAGE_SHIFT)
#define MAX_NUMNODES 8 #define MAX_NUMNODES 8
extern int pfn_to_nid(unsigned long);
extern void get_memcfg_numaq(void); extern void get_memcfg_numaq(void);
#define get_memcfg_numa() get_memcfg_numaq() #define get_memcfg_numa() get_memcfg_numaq()
......
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