Merge git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
[wrt350n-kernel.git] / include / asm-sparc64 / pgalloc.h
blob3ee2d406373b9fc03a671d2c28b49adbb91dd634
1 /* $Id: pgalloc.h,v 1.30 2001/12/21 04:56:17 davem Exp $ */
2 #ifndef _SPARC64_PGALLOC_H
3 #define _SPARC64_PGALLOC_H
5 #include <linux/kernel.h>
6 #include <linux/sched.h>
7 #include <linux/mm.h>
8 #include <linux/slab.h>
9 #include <linux/quicklist.h>
11 #include <asm/spitfire.h>
12 #include <asm/cpudata.h>
13 #include <asm/cacheflush.h>
14 #include <asm/page.h>
16 /* Page table allocation/freeing. */
18 static inline pgd_t *pgd_alloc(struct mm_struct *mm)
20 return quicklist_alloc(0, GFP_KERNEL, NULL);
23 static inline void pgd_free(struct mm_struct *mm, pgd_t *pgd)
25 quicklist_free(0, NULL, pgd);
28 #define pud_populate(MM, PUD, PMD) pud_set(PUD, PMD)
30 static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long addr)
32 return quicklist_alloc(0, GFP_KERNEL, NULL);
35 static inline void pmd_free(struct mm_struct *mm, pmd_t *pmd)
37 quicklist_free(0, NULL, pmd);
40 static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm,
41 unsigned long address)
43 return quicklist_alloc(0, GFP_KERNEL, NULL);
46 static inline pgtable_t pte_alloc_one(struct mm_struct *mm,
47 unsigned long address)
49 struct page *page;
50 void *pg;
52 pg = quicklist_alloc(0, GFP_KERNEL, NULL);
53 if (!pg)
54 return NULL;
55 page = virt_to_page(pg);
56 pgtable_page_ctor(page);
57 return page;
60 static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte)
62 quicklist_free(0, NULL, pte);
65 static inline void pte_free(struct mm_struct *mm, pgtable_t ptepage)
67 pgtable_page_dtor(ptepage);
68 quicklist_free_page(0, NULL, ptepage);
72 #define pmd_populate_kernel(MM, PMD, PTE) pmd_set(PMD, PTE)
73 #define pmd_populate(MM,PMD,PTE_PAGE) \
74 pmd_populate_kernel(MM,PMD,page_address(PTE_PAGE))
75 #define pmd_pgtable(pmd) pmd_page(pmd)
77 static inline void check_pgt_cache(void)
79 quicklist_trim(0, NULL, 25, 16);
82 #endif /* _SPARC64_PGALLOC_H */