aboutsummaryrefslogtreecommitdiffstats
path: root/mm/memory.c
diff options
context:
space:
mode:
authorChristoph Lameter <clameter@sgi.com>2008-02-05 01:28:31 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2008-02-05 12:44:13 -0500
commit48667e7a43c1a1e0ba743f93ae946f8cb34ff2f9 (patch)
treeb2fb79d16fbac46a859f8332cf95852b73839e07 /mm/memory.c
parenteebd2aa355692afaf9906f62118620f1a1c19dbb (diff)
Move vmalloc_to_page() to mm/vmalloc.
We already have page table manipulation for vmalloc in vmalloc.c. Move the vmalloc_to_page() function there as well. Move the definitions for vmalloc related functions in mm.h to a newly created section. A better place would be vmalloc.h but mm.h is basic and may depend on these functions. An alternative would be to include vmalloc.h in mm.h (like done for vmstat.h). Signed-off-by: Christoph Lameter <clameter@sgi.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/memory.c')
-rw-r--r--mm/memory.c40
1 files changed, 0 insertions, 40 deletions
diff --git a/mm/memory.c b/mm/memory.c
index d902d0e25edc..1b8ca160f1d0 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -2618,46 +2618,6 @@ int make_pages_present(unsigned long addr, unsigned long end)
2618 return ret == len ? 0 : -1; 2618 return ret == len ? 0 : -1;
2619} 2619}
2620 2620
2621/*
2622 * Map a vmalloc()-space virtual address to the physical page.
2623 */
2624struct page * vmalloc_to_page(void * vmalloc_addr)
2625{
2626 unsigned long addr = (unsigned long) vmalloc_addr;
2627 struct page *page = NULL;
2628 pgd_t *pgd = pgd_offset_k(addr);
2629 pud_t *pud;
2630 pmd_t *pmd;
2631 pte_t *ptep, pte;
2632
2633 if (!pgd_none(*pgd)) {
2634 pud = pud_offset(pgd, addr);
2635 if (!pud_none(*pud)) {
2636 pmd = pmd_offset(pud, addr);
2637 if (!pmd_none(*pmd)) {
2638 ptep = pte_offset_map(pmd, addr);
2639 pte = *ptep;
2640 if (pte_present(pte))
2641 page = pte_page(pte);
2642 pte_unmap(ptep);
2643 }
2644 }
2645 }
2646 return page;
2647}
2648
2649EXPORT_SYMBOL(vmalloc_to_page);
2650
2651/*
2652 * Map a vmalloc()-space virtual address to the physical page frame number.
2653 */
2654unsigned long vmalloc_to_pfn(void * vmalloc_addr)
2655{
2656 return page_to_pfn(vmalloc_to_page(vmalloc_addr));
2657}
2658
2659EXPORT_SYMBOL(vmalloc_to_pfn);
2660
2661#if !defined(__HAVE_ARCH_GATE_AREA) 2621#if !defined(__HAVE_ARCH_GATE_AREA)
2662 2622
2663#if defined(AT_SYSINFO_EHDR) 2623#if defined(AT_SYSINFO_EHDR)