diff options
Diffstat (limited to 'mm/page_alloc.c')
-rw-r--r-- | mm/page_alloc.c | 32 |
1 files changed, 2 insertions, 30 deletions
diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 9dfbe6b7d1c8..5af33186a25f 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c | |||
@@ -2879,42 +2879,14 @@ void *__init alloc_large_system_hash(const char *tablename, | |||
2879 | } | 2879 | } |
2880 | 2880 | ||
2881 | #ifdef CONFIG_OUT_OF_LINE_PFN_TO_PAGE | 2881 | #ifdef CONFIG_OUT_OF_LINE_PFN_TO_PAGE |
2882 | /* | ||
2883 | * pfn <-> page translation. out-of-line version. | ||
2884 | * (see asm-generic/memory_model.h) | ||
2885 | */ | ||
2886 | #if defined(CONFIG_FLATMEM) | ||
2887 | struct page *pfn_to_page(unsigned long pfn) | ||
2888 | { | ||
2889 | return mem_map + (pfn - ARCH_PFN_OFFSET); | ||
2890 | } | ||
2891 | unsigned long page_to_pfn(struct page *page) | ||
2892 | { | ||
2893 | return (page - mem_map) + ARCH_PFN_OFFSET; | ||
2894 | } | ||
2895 | #elif defined(CONFIG_DISCONTIGMEM) | ||
2896 | struct page *pfn_to_page(unsigned long pfn) | 2882 | struct page *pfn_to_page(unsigned long pfn) |
2897 | { | 2883 | { |
2898 | int nid = arch_pfn_to_nid(pfn); | 2884 | return __pfn_to_page(pfn); |
2899 | return NODE_DATA(nid)->node_mem_map + arch_local_page_offset(pfn,nid); | ||
2900 | } | 2885 | } |
2901 | unsigned long page_to_pfn(struct page *page) | 2886 | unsigned long page_to_pfn(struct page *page) |
2902 | { | 2887 | { |
2903 | struct pglist_data *pgdat = NODE_DATA(page_to_nid(page)); | 2888 | return __page_to_pfn(page); |
2904 | return (page - pgdat->node_mem_map) + pgdat->node_start_pfn; | ||
2905 | } | ||
2906 | #elif defined(CONFIG_SPARSEMEM) | ||
2907 | struct page *pfn_to_page(unsigned long pfn) | ||
2908 | { | ||
2909 | return __section_mem_map_addr(__pfn_to_section(pfn)) + pfn; | ||
2910 | } | ||
2911 | |||
2912 | unsigned long page_to_pfn(struct page *page) | ||
2913 | { | ||
2914 | long section_id = page_to_section(page); | ||
2915 | return page - __section_mem_map_addr(__nr_to_section(section_id)); | ||
2916 | } | 2889 | } |
2917 | #endif /* CONFIG_FLATMEM/DISCONTIGMME/SPARSEMEM */ | ||
2918 | EXPORT_SYMBOL(pfn_to_page); | 2890 | EXPORT_SYMBOL(pfn_to_page); |
2919 | EXPORT_SYMBOL(page_to_pfn); | 2891 | EXPORT_SYMBOL(page_to_pfn); |
2920 | #endif /* CONFIG_OUT_OF_LINE_PFN_TO_PAGE */ | 2892 | #endif /* CONFIG_OUT_OF_LINE_PFN_TO_PAGE */ |