diff options
author | KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> | 2006-03-27 04:15:25 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-03-27 11:44:44 -0500 |
commit | a117e66ed45ac0569c039ea60bd7a9a61e031858 (patch) | |
tree | 292367ab930f83c418c34d4c46f95717e5e6394e /include/linux/mmzone.h | |
parent | b06be912a3ad68c69dba0ed6e92723140020e392 (diff) |
[PATCH] unify pfn_to_page: generic functions
There are 3 memory models, FLATMEM, DISCONTIGMEM, SPARSEMEM.
Each arch has its own page_to_pfn(), pfn_to_page() for each models.
But most of them can use the same arithmetic.
This patch adds asm-generic/memory_model.h, which includes generic
page_to_pfn(), pfn_to_page() definitions for each memory model.
When CONFIG_OUT_OF_LINE_PFN_TO_PAGE=y, out-of-line functions are
used instead of macro. This is enabled by some archs and reduces
text size.
Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Hugh Dickins <hugh@veritas.com>
Cc: Andi Kleen <ak@muc.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Richard Henderson <rth@twiddle.net>
Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
Cc: Russell King <rmk@arm.linux.org.uk>
Cc: Ian Molton <spyro@f2s.com>
Cc: Mikael Starvik <starvik@axis.com>
Cc: David Howells <dhowells@redhat.com>
Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
Cc: Hirokazu Takata <takata.hirokazu@renesas.com>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: Kyle McMartin <kyle@mcmartin.ca>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Paul Mundt <lethal@linux-sh.org>
Cc: Kazumoto Kojima <kkojima@rr.iij4u.or.jp>
Cc: Richard Curnow <rc@rc0.org.uk>
Cc: William Lee Irwin III <wli@holomorphy.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Jeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Cc: Miles Bader <uclinux-v850@lsi.nec.co.jp>
Cc: Chris Zankel <chris@zankel.net>
Cc: "Luck, Tony" <tony.luck@intel.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'include/linux/mmzone.h')
-rw-r--r-- | include/linux/mmzone.h | 11 |
1 files changed, 0 insertions, 11 deletions
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h index ebfc238cc243..0c1c0c0cce65 100644 --- a/include/linux/mmzone.h +++ b/include/linux/mmzone.h | |||
@@ -602,17 +602,6 @@ static inline struct mem_section *__pfn_to_section(unsigned long pfn) | |||
602 | return __nr_to_section(pfn_to_section_nr(pfn)); | 602 | return __nr_to_section(pfn_to_section_nr(pfn)); |
603 | } | 603 | } |
604 | 604 | ||
605 | #define pfn_to_page(pfn) \ | ||
606 | ({ \ | ||
607 | unsigned long __pfn = (pfn); \ | ||
608 | __section_mem_map_addr(__pfn_to_section(__pfn)) + __pfn; \ | ||
609 | }) | ||
610 | #define page_to_pfn(page) \ | ||
611 | ({ \ | ||
612 | page - __section_mem_map_addr(__nr_to_section( \ | ||
613 | page_to_section(page))); \ | ||
614 | }) | ||
615 | |||
616 | static inline int pfn_valid(unsigned long pfn) | 605 | static inline int pfn_valid(unsigned long pfn) |
617 | { | 606 | { |
618 | if (pfn_to_section_nr(pfn) >= NR_MEM_SECTIONS) | 607 | if (pfn_to_section_nr(pfn) >= NR_MEM_SECTIONS) |