AGP fix race condition between unmapping and freeing pages
[linux-2.6/mini2440.git] / include / asm-ia64 / pgalloc.h
blob67552cad517339dea7791ce825ca00109d6602f3
1 #ifndef _ASM_IA64_PGALLOC_H
2 #define _ASM_IA64_PGALLOC_H
4 /*
5 * This file contains the functions and defines necessary to allocate
6 * page tables.
8 * This hopefully works with any (fixed) ia-64 page-size, as defined
9 * in <asm/page.h> (currently 8192).
11 * Copyright (C) 1998-2001 Hewlett-Packard Co
12 * David Mosberger-Tang <davidm@hpl.hp.com>
13 * Copyright (C) 2000, Goutham Rao <goutham.rao@intel.com>
17 #include <linux/compiler.h>
18 #include <linux/mm.h>
19 #include <linux/page-flags.h>
20 #include <linux/threads.h>
21 #include <linux/quicklist.h>
23 #include <asm/mmu_context.h>
25 static inline pgd_t *pgd_alloc(struct mm_struct *mm)
27 return quicklist_alloc(0, GFP_KERNEL, NULL);
30 static inline void pgd_free(pgd_t * pgd)
32 quicklist_free(0, NULL, pgd);
35 #ifdef CONFIG_PGTABLE_4
36 static inline void
37 pgd_populate(struct mm_struct *mm, pgd_t * pgd_entry, pud_t * pud)
39 pgd_val(*pgd_entry) = __pa(pud);
42 static inline pud_t *pud_alloc_one(struct mm_struct *mm, unsigned long addr)
44 return quicklist_alloc(0, GFP_KERNEL, NULL);
47 static inline void pud_free(pud_t * pud)
49 quicklist_free(0, NULL, pud);
51 #define __pud_free_tlb(tlb, pud) pud_free(pud)
52 #endif /* CONFIG_PGTABLE_4 */
54 static inline void
55 pud_populate(struct mm_struct *mm, pud_t * pud_entry, pmd_t * pmd)
57 pud_val(*pud_entry) = __pa(pmd);
60 static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long addr)
62 return quicklist_alloc(0, GFP_KERNEL, NULL);
65 static inline void pmd_free(pmd_t * pmd)
67 quicklist_free(0, NULL, pmd);
70 #define __pmd_free_tlb(tlb, pmd) pmd_free(pmd)
72 static inline void
73 pmd_populate(struct mm_struct *mm, pmd_t * pmd_entry, struct page *pte)
75 pmd_val(*pmd_entry) = page_to_phys(pte);
78 static inline void
79 pmd_populate_kernel(struct mm_struct *mm, pmd_t * pmd_entry, pte_t * pte)
81 pmd_val(*pmd_entry) = __pa(pte);
84 static inline struct page *pte_alloc_one(struct mm_struct *mm,
85 unsigned long addr)
87 void *pg = quicklist_alloc(0, GFP_KERNEL, NULL);
88 return pg ? virt_to_page(pg) : NULL;
91 static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm,
92 unsigned long addr)
94 return quicklist_alloc(0, GFP_KERNEL, NULL);
97 static inline void pte_free(struct page *pte)
99 quicklist_free_page(0, NULL, pte);
102 static inline void pte_free_kernel(pte_t * pte)
104 quicklist_free(0, NULL, pte);
107 static inline void check_pgt_cache(void)
109 quicklist_trim(0, NULL, 25, 16);
112 #define __pte_free_tlb(tlb, pte) pte_free(pte)
114 #endif /* _ASM_IA64_PGALLOC_H */