revert-mm-fix-blkdev-size-calculation-in-generic_write_checks
[linux-2.6/linux-trees-mm.git] / include / asm-x86 / pgalloc_32.h
blobf83b40cdcac56c169fa822daa8a5c88f4f390fe4
1 #ifndef _I386_PGALLOC_H
2 #define _I386_PGALLOC_H
4 #include <linux/threads.h>
5 #include <linux/mm.h> /* for struct page */
7 #ifdef CONFIG_PARAVIRT
8 #include <asm/paravirt.h>
9 #else
10 #define paravirt_alloc_pt(mm, pfn) do { } while (0)
11 #define paravirt_alloc_pd(pfn) do { } while (0)
12 #define paravirt_alloc_pd(pfn) do { } while (0)
13 #define paravirt_alloc_pd_clone(pfn, clonepfn, start, count) do { } while (0)
14 #define paravirt_release_pt(pfn) do { } while (0)
15 #define paravirt_release_pd(pfn) do { } while (0)
16 #endif
18 #define pmd_populate_kernel(mm, pmd, pte) \
19 do { \
20 paravirt_alloc_pt(mm, __pa(pte) >> PAGE_SHIFT); \
21 set_pmd(pmd, __pmd(_PAGE_TABLE + __pa(pte))); \
22 } while (0)
24 #define pmd_populate(mm, pmd, pte) \
25 do { \
26 paravirt_alloc_pt(mm, page_to_pfn(pte)); \
27 set_pmd(pmd, __pmd(_PAGE_TABLE + \
28 ((unsigned long long)page_to_pfn(pte) << \
29 (unsigned long long) PAGE_SHIFT))); \
30 } while (0)
31 #define pmd_pgtable(pmd) pmd_page(pmd)
34 * Allocate and free page tables.
36 extern pgd_t *pgd_alloc(struct mm_struct *);
37 extern void pgd_free(struct mm_struct *mm, pgd_t *pgd);
39 extern pte_t *pte_alloc_one_kernel(struct mm_struct *, unsigned long);
40 extern pgtable_t pte_alloc_one(struct mm_struct *, unsigned long);
42 static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte)
44 free_page((unsigned long)pte);
47 static inline void pte_free(struct mm_struct *mm, pgtable_t pte)
49 pgtable_page_dtor(pte);
50 __free_page(pte);
54 #define __pte_free_tlb(tlb,pte) \
55 do { \
56 pgtable_page_dtor(pte); \
57 paravirt_release_pt(page_to_pfn(pte)); \
58 tlb_remove_page((tlb),(pte)); \
59 } while (0)
61 #ifdef CONFIG_X86_PAE
63 * In the PAE case we free the pmds as part of the pgd.
65 #define pmd_alloc_one(mm, addr) ({ BUG(); ((pmd_t *)2); })
66 #define pmd_free(mm, x) do { } while (0)
67 #define __pmd_free_tlb(tlb,x) do { } while (0)
68 #define pud_populate(mm, pmd, pte) BUG()
69 #endif
71 #endif /* _I386_PGALLOC_H */