This commit was generated by cvs2svn to compensate for changes in r925,
[linux-2.6.git] / include / asm-ppc64 / pgalloc.h
1 #ifndef _PPC64_PGALLOC_H
2 #define _PPC64_PGALLOC_H
3
4 #include <linux/mm.h>
5 #include <linux/slab.h>
6 #include <linux/cpumask.h>
7 #include <linux/percpu.h>
8
9 extern kmem_cache_t *zero_cache;
10
11 /* Dummy functions since we don't support execshield on ppc */
12 #define arch_add_exec_range(mm, limit) do { ; } while (0)
13 #define arch_flush_exec_range(mm)      do { ; } while (0)
14 #define arch_remove_exec_range(mm, limit) do { ; } while (0)
15
16 /*
17  * This program is free software; you can redistribute it and/or
18  * modify it under the terms of the GNU General Public License
19  * as published by the Free Software Foundation; either version
20  * 2 of the License, or (at your option) any later version.
21  */
22
23 static inline pgd_t *
24 pgd_alloc(struct mm_struct *mm)
25 {
26         return kmem_cache_alloc(zero_cache, GFP_KERNEL);
27 }
28
29 static inline void
30 pgd_free(pgd_t *pgd)
31 {
32         kmem_cache_free(zero_cache, pgd);
33 }
34
35 #define pud_populate(MM, PUD, PMD)      pud_set(PUD, PMD)
36
37 static inline pmd_t *
38 pmd_alloc_one(struct mm_struct *mm, unsigned long addr)
39 {
40         return kmem_cache_alloc(zero_cache, GFP_KERNEL|__GFP_REPEAT);
41 }
42
43 static inline void
44 pmd_free(pmd_t *pmd)
45 {
46         kmem_cache_free(zero_cache, pmd);
47 }
48
49 #define pmd_populate_kernel(mm, pmd, pte) pmd_set(pmd, pte)
50 #define pmd_populate(mm, pmd, pte_page) \
51         pmd_populate_kernel(mm, pmd, page_address(pte_page))
52
53 static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm, unsigned long address)
54 {
55         return kmem_cache_alloc(zero_cache, GFP_KERNEL|__GFP_REPEAT);
56 }
57
58 static inline struct page *pte_alloc_one(struct mm_struct *mm, unsigned long address)
59 {
60         pte_t *pte = kmem_cache_alloc(zero_cache, GFP_KERNEL|__GFP_REPEAT);
61         if (pte)
62                 return virt_to_page(pte);
63         return NULL;
64 }
65                 
66 static inline void pte_free_kernel(pte_t *pte)
67 {
68         kmem_cache_free(zero_cache, pte);
69 }
70
71 static inline void pte_free(struct page *ptepage)
72 {
73         kmem_cache_free(zero_cache, page_address(ptepage));
74 }
75
76 struct pte_freelist_batch
77 {
78         struct rcu_head rcu;
79         unsigned int    index;
80         struct page *   pages[0];
81 };
82
83 #define PTE_FREELIST_SIZE       ((PAGE_SIZE - sizeof(struct pte_freelist_batch)) / \
84                                   sizeof(struct page *))
85
86 extern void pte_free_now(struct page *ptepage);
87 extern void pte_free_submit(struct pte_freelist_batch *batch);
88
89 DECLARE_PER_CPU(struct pte_freelist_batch *, pte_freelist_cur);
90
91 void __pte_free_tlb(struct mmu_gather *tlb, struct page *ptepage);
92 #define __pmd_free_tlb(tlb, pmd)        __pte_free_tlb(tlb, virt_to_page(pmd))
93
94 #define check_pgt_cache()       do { } while (0)
95
96 #endif /* _PPC64_PGALLOC_H */