1 #ifndef _PPC64_PGALLOC_H
2 #define _PPC64_PGALLOC_H
4 #include <linux/threads.h>
5 #include <asm/processor.h>
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License
12 * as published by the Free Software Foundation; either version
13 * 2 of the License, or (at your option) any later version.
15 #define quicklists get_paca()
17 #define pgd_quicklist (quicklists->pgd_cache)
18 #define pmd_quicklist (quicklists->pmd_cache)
19 #define pte_quicklist (quicklists->pte_cache)
20 #define pgtable_cache_size (quicklists->pgtable_cache_sz)
23 pgd_alloc_one_fast (struct mm_struct *mm)
25 unsigned long *ret = pgd_quicklist;
28 pgd_quicklist = (unsigned long *)(*ret);
37 pgd_alloc (struct mm_struct *mm)
39 /* the VM system never calls pgd_alloc_one_fast(), so we do it here. */
40 pgd_t *pgd = pgd_alloc_one_fast(mm);
43 pgd = (pgd_t *)__get_free_page(GFP_KERNEL);
53 *(unsigned long *)pgd = (unsigned long) pgd_quicklist;
54 pgd_quicklist = (unsigned long *) pgd;
58 #define pgd_populate(MM, PGD, PMD) pgd_set(PGD, PMD)
61 pmd_alloc_one_fast (struct mm_struct *mm, unsigned long addr)
63 unsigned long *ret = (unsigned long *)pmd_quicklist;
66 pmd_quicklist = (unsigned long *)(*ret);
74 pmd_alloc_one (struct mm_struct *mm, unsigned long addr)
76 pmd_t *pmd = (pmd_t *) __get_free_page(GFP_KERNEL);
86 *(unsigned long *)pmd = (unsigned long) pmd_quicklist;
87 pmd_quicklist = (unsigned long *) pmd;
91 #define pmd_populate(MM, PMD, PTE) pmd_set(PMD, PTE)
94 pte_alloc_one_fast (struct mm_struct *mm, unsigned long addr)
96 unsigned long *ret = (unsigned long *)pte_quicklist;
99 pte_quicklist = (unsigned long *)(*ret);
101 --pgtable_cache_size;
108 pte_alloc_one (struct mm_struct *mm, unsigned long addr)
110 pte_t *pte = (pte_t *) __get_free_page(GFP_KERNEL);
118 pte_free (pte_t *pte)
120 *(unsigned long *)pte = (unsigned long) pte_quicklist;
121 pte_quicklist = (unsigned long *) pte;
122 ++pgtable_cache_size;
125 extern int do_check_pgt_cache(int, int);
127 #endif /* _PPC64_PGALLOC_H */