提交 dc8ecb43 编写于 作者: K KAMEZAWA Hiroyuki 提交者: Linus Torvalds

[PATCH] unify pfn_to_page: x86_64 pfn_to_page

x86_64 can use generic funcs.
For DISCONTIGMEM, CONFIG_OUT_OF_LINE_PFN_TO_PAGE is selected.
Signed-off-by: NKAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Andi Kleen <ak@muc.de>
Signed-off-by: NAndrew Morton <akpm@osdl.org>
Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
上级 ad658b38
...@@ -334,6 +334,10 @@ config HAVE_ARCH_EARLY_PFN_TO_NID ...@@ -334,6 +334,10 @@ config HAVE_ARCH_EARLY_PFN_TO_NID
def_bool y def_bool y
depends on NUMA depends on NUMA
config OUT_OF_LINE_PFN_TO_PAGE
def_bool y
depends on DISCONTIGMEM
config NR_CPUS config NR_CPUS
int "Maximum number of CPUs (2-256)" int "Maximum number of CPUs (2-256)"
range 2 255 range 2 255
......
...@@ -377,21 +377,6 @@ EXPORT_SYMBOL(node_data); ...@@ -377,21 +377,6 @@ EXPORT_SYMBOL(node_data);
* Should do that. * Should do that.
*/ */
/* Requires pfn_valid(pfn) to be true */
struct page *pfn_to_page(unsigned long pfn)
{
int nid = phys_to_nid(((unsigned long)(pfn)) << PAGE_SHIFT);
return (pfn - node_start_pfn(nid)) + NODE_DATA(nid)->node_mem_map;
}
EXPORT_SYMBOL(pfn_to_page);
unsigned long page_to_pfn(struct page *page)
{
return (long)(((page) - page_zone(page)->zone_mem_map) +
page_zone(page)->zone_start_pfn);
}
EXPORT_SYMBOL(page_to_pfn);
int pfn_valid(unsigned long pfn) int pfn_valid(unsigned long pfn)
{ {
unsigned nid; unsigned nid;
......
...@@ -44,12 +44,8 @@ static inline __attribute__((pure)) int phys_to_nid(unsigned long addr) ...@@ -44,12 +44,8 @@ static inline __attribute__((pure)) int phys_to_nid(unsigned long addr)
#define pfn_to_nid(pfn) phys_to_nid((unsigned long)(pfn) << PAGE_SHIFT) #define pfn_to_nid(pfn) phys_to_nid((unsigned long)(pfn) << PAGE_SHIFT)
#define kvaddr_to_nid(kaddr) phys_to_nid(__pa(kaddr)) #define kvaddr_to_nid(kaddr) phys_to_nid(__pa(kaddr))
extern struct page *pfn_to_page(unsigned long pfn);
extern unsigned long page_to_pfn(struct page *page);
extern int pfn_valid(unsigned long pfn); extern int pfn_valid(unsigned long pfn);
#endif #endif
#define local_mapnr(kvaddr) \
( (__pa(kvaddr) >> PAGE_SHIFT) - node_start_pfn(kvaddr_to_nid(kvaddr)) )
#endif #endif
#endif #endif
...@@ -123,8 +123,6 @@ typedef struct { unsigned long pgprot; } pgprot_t; ...@@ -123,8 +123,6 @@ typedef struct { unsigned long pgprot; } pgprot_t;
#define __boot_va(x) __va(x) #define __boot_va(x) __va(x)
#define __boot_pa(x) __pa(x) #define __boot_pa(x) __pa(x)
#ifdef CONFIG_FLATMEM #ifdef CONFIG_FLATMEM
#define pfn_to_page(pfn) (mem_map + (pfn))
#define page_to_pfn(page) ((unsigned long)((page) - mem_map))
#define pfn_valid(pfn) ((pfn) < end_pfn) #define pfn_valid(pfn) ((pfn) < end_pfn)
#endif #endif
...@@ -140,6 +138,7 @@ typedef struct { unsigned long pgprot; } pgprot_t; ...@@ -140,6 +138,7 @@ typedef struct { unsigned long pgprot; } pgprot_t;
#endif /* __KERNEL__ */ #endif /* __KERNEL__ */
#include <asm-generic/memory_model.h>
#include <asm-generic/page.h> #include <asm-generic/page.h>
#endif /* _X86_64_PAGE_H */ #endif /* _X86_64_PAGE_H */
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册