signal: consolidate {TS,TLF}_RESTORE_SIGMASK code
[deliverable/linux.git] / arch / sh / include / asm / pgalloc.h
CommitLineData
1da177e4
LT
1#ifndef __ASM_SH_PGALLOC_H
2#define __ASM_SH_PGALLOC_H
3
5f8c9908
PM
4#include <linux/quicklist.h>
5#include <asm/page.h>
6
0176bd3d 7#define QUICK_PT 0 /* Other page table pages that are zero on free */
5f8c9908 8
2a5eacca
MF
9extern pgd_t *pgd_alloc(struct mm_struct *);
10extern void pgd_free(struct mm_struct *mm, pgd_t *pgd);
11
782bb5a5 12#if PAGETABLE_LEVELS > 2
2a5eacca
MF
13extern void pud_populate(struct mm_struct *mm, pud_t *pudp, pmd_t *pmd);
14extern pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long address);
15extern void pmd_free(struct mm_struct *mm, pmd_t *pmd);
5d9b4b19 16#endif
b73c8063 17
99a596f9
SM
18static inline void pmd_populate_kernel(struct mm_struct *mm, pmd_t *pmd,
19 pte_t *pte)
20{
21 set_pmd(pmd, __pmd((unsigned long)pte));
22}
1da177e4
LT
23
24static inline void pmd_populate(struct mm_struct *mm, pmd_t *pmd,
2f569afd 25 pgtable_t pte)
1da177e4 26{
99a596f9 27 set_pmd(pmd, __pmd((unsigned long)page_address(pte)));
1da177e4 28}
2f569afd 29#define pmd_pgtable(pmd) pmd_page(pmd)
1da177e4
LT
30
31/*
32 * Allocate and free page tables.
33 */
1da177e4
LT
34static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm,
35 unsigned long address)
36{
32d6bd90 37 return quicklist_alloc(QUICK_PT, GFP_KERNEL, NULL);
1da177e4
LT
38}
39
2f569afd
MS
40static inline pgtable_t pte_alloc_one(struct mm_struct *mm,
41 unsigned long address)
1da177e4 42{
2f569afd
MS
43 struct page *page;
44 void *pg;
45
32d6bd90 46 pg = quicklist_alloc(QUICK_PT, GFP_KERNEL, NULL);
2f569afd
MS
47 if (!pg)
48 return NULL;
49 page = virt_to_page(pg);
478cf8ca
KS
50 if (!pgtable_page_ctor(page)) {
51 quicklist_free(QUICK_PT, NULL, pg);
52 return NULL;
53 }
2f569afd 54 return page;
1da177e4
LT
55}
56
5e541973 57static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte)
1da177e4 58{
5f8c9908 59 quicklist_free(QUICK_PT, NULL, pte);
1da177e4
LT
60}
61
2f569afd 62static inline void pte_free(struct mm_struct *mm, pgtable_t pte)
1da177e4 63{
2f569afd 64 pgtable_page_dtor(pte);
5f8c9908 65 quicklist_free_page(QUICK_PT, NULL, pte);
1da177e4
LT
66}
67
9e1b32ca 68#define __pte_free_tlb(tlb,pte,addr) \
2f569afd
MS
69do { \
70 pgtable_page_dtor(pte); \
71 tlb_remove_page((tlb), (pte)); \
72} while (0)
1da177e4 73
5f8c9908
PM
74static inline void check_pgt_cache(void)
75{
5f8c9908
PM
76 quicklist_trim(QUICK_PT, NULL, 25, 16);
77}
1da177e4 78
1da177e4 79#endif /* __ASM_SH_PGALLOC_H */
This page took 0.800365 seconds and 5 git commands to generate.