Merge branch 'bugfixes' of git://git.linux-nfs.org/projects/trondmy/nfs-2.6
[linux-2.6/mini2440.git] / arch / alpha / include / asm / pgalloc.h
blobbc2a0daf2d9266f067af47feb0bd469893cc3658
1 #ifndef _ALPHA_PGALLOC_H
2 #define _ALPHA_PGALLOC_H
4 #include <linux/mm.h>
5 #include <linux/mmzone.h>
7 /*
8 * Allocate and free page tables. The xxx_kernel() versions are
9 * used to allocate a kernel page table - this turns on ASN bits
10 * if any.
13 static inline void
14 pmd_populate(struct mm_struct *mm, pmd_t *pmd, pgtable_t pte)
16 pmd_set(pmd, (pte_t *)(page_to_pa(pte) + PAGE_OFFSET));
18 #define pmd_pgtable(pmd) pmd_page(pmd)
20 static inline void
21 pmd_populate_kernel(struct mm_struct *mm, pmd_t *pmd, pte_t *pte)
23 pmd_set(pmd, pte);
26 static inline void
27 pgd_populate(struct mm_struct *mm, pgd_t *pgd, pmd_t *pmd)
29 pgd_set(pgd, pmd);
32 extern pgd_t *pgd_alloc(struct mm_struct *mm);
34 static inline void
35 pgd_free(struct mm_struct *mm, pgd_t *pgd)
37 free_page((unsigned long)pgd);
40 static inline pmd_t *
41 pmd_alloc_one(struct mm_struct *mm, unsigned long address)
43 pmd_t *ret = (pmd_t *)__get_free_page(GFP_KERNEL|__GFP_REPEAT|__GFP_ZERO);
44 return ret;
47 static inline void
48 pmd_free(struct mm_struct *mm, pmd_t *pmd)
50 free_page((unsigned long)pmd);
53 static inline pte_t *
54 pte_alloc_one_kernel(struct mm_struct *mm, unsigned long address)
56 pte_t *pte = (pte_t *)__get_free_page(GFP_KERNEL|__GFP_REPEAT|__GFP_ZERO);
57 return pte;
60 static inline void
61 pte_free_kernel(struct mm_struct *mm, pte_t *pte)
63 free_page((unsigned long)pte);
66 static inline pgtable_t
67 pte_alloc_one(struct mm_struct *mm, unsigned long address)
69 pte_t *pte = pte_alloc_one_kernel(mm, address);
70 struct page *page;
72 if (!pte)
73 return NULL;
74 page = virt_to_page(pte);
75 pgtable_page_ctor(page);
76 return page;
79 static inline void
80 pte_free(struct mm_struct *mm, pgtable_t page)
82 pgtable_page_dtor(page);
83 __free_page(page);
86 #define check_pgt_cache() do { } while (0)
88 #endif /* _ALPHA_PGALLOC_H */