From: "Martin J. Bligh" <mbligh@aracnet.com>
To: Linus Torvalds <torvalds@transmeta.com>
Cc: linux-kernel <linux-kernel@vger.kernel.org>,
Bill Irwin <wli@holomorphy.com>
Subject: [PATCH] 3/7 Move pfn_to_nid inline
Date: Fri, 28 Feb 2003 13:33:57 -0800 [thread overview]
Message-ID: <361330000.1046468037@flay> (raw)
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.
diff -urpN -X /home/fletch/.diff.exclude 011-mpc_apic_id/arch/i386/kernel/i386_ksyms.c 012-pfn_to_nid/arch/i386/kernel/i386_ksyms.c
--- 011-mpc_apic_id/arch/i386/kernel/i386_ksyms.c Tue Feb 25 23:03:43 2003
+++ 012-pfn_to_nid/arch/i386/kernel/i386_ksyms.c Fri Feb 28 08:05:34 2003
@@ -68,7 +68,6 @@ EXPORT_SYMBOL(EISA_bus);
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 -urpN -X /home/fletch/.diff.exclude 011-mpc_apic_id/arch/i386/kernel/numaq.c 012-pfn_to_nid/arch/i386/kernel/numaq.c
--- 011-mpc_apic_id/arch/i386/kernel/numaq.c Sun Nov 17 20:29:51 2002
+++ 012-pfn_to_nid/arch/i386/kernel/numaq.c Fri Feb 28 08:05:34 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 @@ static void __init smp_dump_qct(void)
* 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 -urpN -X /home/fletch/.diff.exclude 011-mpc_apic_id/include/asm-i386/numaq.h 012-pfn_to_nid/include/asm-i386/numaq.h
--- 011-mpc_apic_id/include/asm-i386/numaq.h Thu Jan 9 19:16:11 2003
+++ 012-pfn_to_nid/include/asm-i386/numaq.h Fri Feb 28 08:05:34 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()
reply other threads:[~2003-02-28 21:35 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=361330000.1046468037@flay \
--to=mbligh@aracnet.com \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@transmeta.com \
--cc=wli@holomorphy.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox