fs/reiserfs/journal.c: change return type of dirty_one_transaction
[linux/fpc-iii.git] / arch / sh / include / asm / pgalloc.h
blobb56f908b13950e31335984ec09c2f88973915c90
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef __ASM_SH_PGALLOC_H
3 #define __ASM_SH_PGALLOC_H
5 #include <linux/quicklist.h>
6 #include <asm/page.h>
8 #define QUICK_PT 0 /* Other page table pages that are zero on free */
10 extern pgd_t *pgd_alloc(struct mm_struct *);
11 extern void pgd_free(struct mm_struct *mm, pgd_t *pgd);
13 #if PAGETABLE_LEVELS > 2
14 extern void pud_populate(struct mm_struct *mm, pud_t *pudp, pmd_t *pmd);
15 extern pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long address);
16 extern void pmd_free(struct mm_struct *mm, pmd_t *pmd);
17 #endif
19 static inline void pmd_populate_kernel(struct mm_struct *mm, pmd_t *pmd,
20 pte_t *pte)
22 set_pmd(pmd, __pmd((unsigned long)pte));
25 static inline void pmd_populate(struct mm_struct *mm, pmd_t *pmd,
26 pgtable_t pte)
28 set_pmd(pmd, __pmd((unsigned long)page_address(pte)));
30 #define pmd_pgtable(pmd) pmd_page(pmd)
33 * Allocate and free page tables.
35 static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm)
37 return quicklist_alloc(QUICK_PT, GFP_KERNEL, NULL);
40 static inline pgtable_t pte_alloc_one(struct mm_struct *mm)
42 struct page *page;
43 void *pg;
45 pg = quicklist_alloc(QUICK_PT, GFP_KERNEL, NULL);
46 if (!pg)
47 return NULL;
48 page = virt_to_page(pg);
49 if (!pgtable_page_ctor(page)) {
50 quicklist_free(QUICK_PT, NULL, pg);
51 return NULL;
53 return page;
56 static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte)
58 quicklist_free(QUICK_PT, NULL, pte);
61 static inline void pte_free(struct mm_struct *mm, pgtable_t pte)
63 pgtable_page_dtor(pte);
64 quicklist_free_page(QUICK_PT, NULL, pte);
67 #define __pte_free_tlb(tlb,pte,addr) \
68 do { \
69 pgtable_page_dtor(pte); \
70 tlb_remove_page((tlb), (pte)); \
71 } while (0)
73 #if CONFIG_PGTABLE_LEVELS > 2
74 #define __pmd_free_tlb(tlb, pmdp, addr) \
75 do { \
76 struct page *page = virt_to_page(pmdp); \
77 pgtable_pmd_page_dtor(page); \
78 tlb_remove_page((tlb), page); \
79 } while (0);
80 #endif
82 static inline void check_pgt_cache(void)
84 quicklist_trim(QUICK_PT, NULL, 25, 16);
87 #endif /* __ASM_SH_PGALLOC_H */