aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86_64/mm/numa.c
diff options
context:
space:
mode:
authorAndi Kleen <ak@suse.de>2006-01-11 16:46:27 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-01-11 22:05:01 -0500
commitcf0501328674849f8becf6de16620067a0c2f1b5 (patch)
tree6f449d3b82bc178573d8a991e29c1eff8e6b94a5 /arch/x86_64/mm/numa.c
parentcdc4b9c01909d606afbc1e4a4b6c21fa1687a016 (diff)
[PATCH] x86_64: Move NUMA page_to_pfn/pfn_to_page functions out of line
Saves about ~18K .text in defconfig There would be more optimization potential, but that's for later. Suggestion originally from Bill Irwin. Fix from Andy Whitcroft. Signed-off-by: Andi Kleen <ak@suse.de> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch/x86_64/mm/numa.c')
-rw-r--r--arch/x86_64/mm/numa.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/arch/x86_64/mm/numa.c b/arch/x86_64/mm/numa.c
index 994dbaeb33f0..6ef9f9a76235 100644
--- a/arch/x86_64/mm/numa.c
+++ b/arch/x86_64/mm/numa.c
@@ -360,3 +360,39 @@ EXPORT_SYMBOL(node_to_cpumask);
360EXPORT_SYMBOL(memnode_shift); 360EXPORT_SYMBOL(memnode_shift);
361EXPORT_SYMBOL(memnodemap); 361EXPORT_SYMBOL(memnodemap);
362EXPORT_SYMBOL(node_data); 362EXPORT_SYMBOL(node_data);
363
364#ifdef CONFIG_DISCONTIGMEM
365/*
366 * Functions to convert PFNs from/to per node page addresses.
367 * These are out of line because they are quite big.
368 * They could be all tuned by pre caching more state.
369 * Should do that.
370 */
371
372/* Requires pfn_valid(pfn) to be true */
373struct page *pfn_to_page(unsigned long pfn)
374{
375 int nid = phys_to_nid(((unsigned long)(pfn)) << PAGE_SHIFT);
376 return (pfn - node_start_pfn(nid)) + NODE_DATA(nid)->node_mem_map;
377}
378EXPORT_SYMBOL(pfn_to_page);
379
380unsigned long page_to_pfn(struct page *page)
381{
382 return (long)(((page) - page_zone(page)->zone_mem_map) +
383 page_zone(page)->zone_start_pfn);
384}
385EXPORT_SYMBOL(page_to_pfn);
386
387int pfn_valid(unsigned long pfn)
388{
389 unsigned nid;
390 if (pfn >= num_physpages)
391 return 0;
392 nid = pfn_to_nid(pfn);
393 if (nid == 0xff)
394 return 0;
395 return pfn >= node_start_pfn(nid) && (pfn) < node_end_pfn(nid);
396}
397EXPORT_SYMBOL(pfn_valid);
398#endif