[prev in list] [next in list] [prev in thread] [next in thread]
List: git-commits-head
Subject: [PATCH] Move pfn_to_nid inline
From: Linux Kernel Mailing List <linux-kernel () vger ! kernel ! org>
Date: 2003-02-28 23:02:28
[Download RAW message or body]
ChangeSet 1.1022.4.3, 2003/02/28 15:02:28-08:00, mbligh@aracnet.com
[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.
# This patch includes the following deltas:
# ChangeSet 1.1022.4.2 -> 1.1022.4.3
# include/asm-i386/numaq.h 1.5 -> 1.5.1.1
# arch/i386/kernel/numaq.c 1.5 -> 1.6
# arch/i386/kernel/i386_ksyms.c 1.45 -> 1.46
#
arch/i386/kernel/i386_ksyms.c | 1 -
arch/i386/kernel/numaq.c | 15 ++-------------
include/asm-i386/numaq.h | 3 ++-
3 files changed, 4 insertions(+), 15 deletions(-)
diff -Nru a/arch/i386/kernel/i386_ksyms.c b/arch/i386/kernel/i386_ksyms.c
--- a/arch/i386/kernel/i386_ksyms.c Fri Feb 28 16:07:45 2003
+++ b/arch/i386/kernel/i386_ksyms.c Fri Feb 28 16:07:45 2003
@@ -68,7 +68,6 @@
EXPORT_SYMBOL(MCA_bus);
#ifdef CONFIG_DISCONTIGMEM
EXPORT_SYMBOL(node_data);
-EXPORT_SYMBOL(pfn_to_nid);
#endif
#ifdef CONFIG_X86_NUMAQ
EXPORT_SYMBOL(xquad_portio);
diff -Nru a/arch/i386/kernel/numaq.c b/arch/i386/kernel/numaq.c
--- a/arch/i386/kernel/numaq.c Fri Feb 28 16:07:45 2003
+++ b/arch/i386/kernel/numaq.c Fri Feb 28 16:07:45 2003
@@ -27,6 +27,7 @@
#include <linux/mm.h>
#include <linux/bootmem.h>
#include <linux/mmzone.h>
+#include <linux/module.h>
#include <asm/numaq.h>
/* These are needed before the pgdat's are created */
@@ -82,19 +83,7 @@
* physnode_map[8- ] = -1;
*/
int physnode_map[MAX_ELEMENTS] = { [0 ... (MAX_ELEMENTS - 1)] = -1};
-
-#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;
-}
+EXPORT_SYMBOL(physnode_map);
/*
* for each node mark the regions
diff -Nru a/include/asm-i386/numaq.h b/include/asm-i386/numaq.h
--- a/include/asm-i386/numaq.h Fri Feb 28 16:07:45 2003
+++ b/include/asm-i386/numaq.h Fri Feb 28 16:07:45 2003
@@ -36,10 +36,11 @@
#define MAX_ELEMENTS 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 PHYSADDR_TO_NID(pa) pfn_to_nid(pa >> PAGE_SHIFT)
#define MAX_NUMNODES 8
-extern int pfn_to_nid(unsigned long);
extern void get_memcfg_numaq(void);
#define get_memcfg_numa() get_memcfg_numaq()
-
To unsubscribe from this list: send the line "unsubscribe bk-commits-head" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic