| .. | .. |
|---|
| 2 | 2 | #ifndef __ASM_SH_PGALLOC_H |
|---|
| 3 | 3 | #define __ASM_SH_PGALLOC_H |
|---|
| 4 | 4 | |
|---|
| 5 | | -#include <linux/quicklist.h> |
|---|
| 6 | 5 | #include <asm/page.h> |
|---|
| 7 | 6 | |
|---|
| 8 | | -#define QUICK_PT 0 /* Other page table pages that are zero on free */ |
|---|
| 7 | +#define __HAVE_ARCH_PMD_ALLOC_ONE |
|---|
| 8 | +#define __HAVE_ARCH_PMD_FREE |
|---|
| 9 | +#define __HAVE_ARCH_PGD_FREE |
|---|
| 10 | +#include <asm-generic/pgalloc.h> |
|---|
| 9 | 11 | |
|---|
| 10 | 12 | extern pgd_t *pgd_alloc(struct mm_struct *); |
|---|
| 11 | 13 | extern void pgd_free(struct mm_struct *mm, pgd_t *pgd); |
|---|
| .. | .. |
|---|
| 14 | 16 | extern void pud_populate(struct mm_struct *mm, pud_t *pudp, pmd_t *pmd); |
|---|
| 15 | 17 | extern pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long address); |
|---|
| 16 | 18 | extern void pmd_free(struct mm_struct *mm, pmd_t *pmd); |
|---|
| 19 | +#define __pmd_free_tlb(tlb, pmdp, addr) pmd_free((tlb)->mm, (pmdp)) |
|---|
| 17 | 20 | #endif |
|---|
| 18 | 21 | |
|---|
| 19 | 22 | static inline void pmd_populate_kernel(struct mm_struct *mm, pmd_t *pmd, |
|---|
| .. | .. |
|---|
| 29 | 32 | } |
|---|
| 30 | 33 | #define pmd_pgtable(pmd) pmd_page(pmd) |
|---|
| 31 | 34 | |
|---|
| 32 | | -/* |
|---|
| 33 | | - * Allocate and free page tables. |
|---|
| 34 | | - */ |
|---|
| 35 | | -static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm, |
|---|
| 36 | | - unsigned long address) |
|---|
| 37 | | -{ |
|---|
| 38 | | - return quicklist_alloc(QUICK_PT, GFP_KERNEL, NULL); |
|---|
| 39 | | -} |
|---|
| 40 | | - |
|---|
| 41 | | -static inline pgtable_t pte_alloc_one(struct mm_struct *mm, |
|---|
| 42 | | - unsigned long address) |
|---|
| 43 | | -{ |
|---|
| 44 | | - struct page *page; |
|---|
| 45 | | - void *pg; |
|---|
| 46 | | - |
|---|
| 47 | | - pg = quicklist_alloc(QUICK_PT, GFP_KERNEL, NULL); |
|---|
| 48 | | - if (!pg) |
|---|
| 49 | | - return NULL; |
|---|
| 50 | | - page = virt_to_page(pg); |
|---|
| 51 | | - if (!pgtable_page_ctor(page)) { |
|---|
| 52 | | - quicklist_free(QUICK_PT, NULL, pg); |
|---|
| 53 | | - return NULL; |
|---|
| 54 | | - } |
|---|
| 55 | | - return page; |
|---|
| 56 | | -} |
|---|
| 57 | | - |
|---|
| 58 | | -static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte) |
|---|
| 59 | | -{ |
|---|
| 60 | | - quicklist_free(QUICK_PT, NULL, pte); |
|---|
| 61 | | -} |
|---|
| 62 | | - |
|---|
| 63 | | -static inline void pte_free(struct mm_struct *mm, pgtable_t pte) |
|---|
| 64 | | -{ |
|---|
| 65 | | - pgtable_page_dtor(pte); |
|---|
| 66 | | - quicklist_free_page(QUICK_PT, NULL, pte); |
|---|
| 67 | | -} |
|---|
| 68 | | - |
|---|
| 69 | 35 | #define __pte_free_tlb(tlb,pte,addr) \ |
|---|
| 70 | 36 | do { \ |
|---|
| 71 | | - pgtable_page_dtor(pte); \ |
|---|
| 37 | + pgtable_pte_page_dtor(pte); \ |
|---|
| 72 | 38 | tlb_remove_page((tlb), (pte)); \ |
|---|
| 73 | 39 | } while (0) |
|---|
| 74 | | - |
|---|
| 75 | | -static inline void check_pgt_cache(void) |
|---|
| 76 | | -{ |
|---|
| 77 | | - quicklist_trim(QUICK_PT, NULL, 25, 16); |
|---|
| 78 | | -} |
|---|
| 79 | 40 | |
|---|
| 80 | 41 | #endif /* __ASM_SH_PGALLOC_H */ |
|---|