diff options
author | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
commit | 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch) | |
tree | 0bba044c4ce775e45a88a51686b5d9f90697ea9d /include/asm-ppc64/pgalloc.h |
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history,
even though we have it. We can create a separate "historical" git
archive of that later if we want to, and in the meantime it's about
3.2GB when imported into git - space that would just make the early
git days unnecessarily complicated, when we don't have a lot of good
infrastructure for it.
Let it rip!
Diffstat (limited to 'include/asm-ppc64/pgalloc.h')
-rw-r--r-- | include/asm-ppc64/pgalloc.h | 91 |
1 files changed, 91 insertions, 0 deletions
diff --git a/include/asm-ppc64/pgalloc.h b/include/asm-ppc64/pgalloc.h new file mode 100644 index 000000000000..16232d740173 --- /dev/null +++ b/include/asm-ppc64/pgalloc.h | |||
@@ -0,0 +1,91 @@ | |||
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 | /* | ||
12 | * This program is free software; you can redistribute it and/or | ||
13 | * modify it under the terms of the GNU General Public License | ||
14 | * as published by the Free Software Foundation; either version | ||
15 | * 2 of the License, or (at your option) any later version. | ||
16 | */ | ||
17 | |||
18 | static inline pgd_t * | ||
19 | pgd_alloc(struct mm_struct *mm) | ||
20 | { | ||
21 | return kmem_cache_alloc(zero_cache, GFP_KERNEL); | ||
22 | } | ||
23 | |||
24 | static inline void | ||
25 | pgd_free(pgd_t *pgd) | ||
26 | { | ||
27 | kmem_cache_free(zero_cache, pgd); | ||
28 | } | ||
29 | |||
30 | #define pgd_populate(MM, PGD, PMD) pgd_set(PGD, PMD) | ||
31 | |||
32 | static inline pmd_t * | ||
33 | pmd_alloc_one(struct mm_struct *mm, unsigned long addr) | ||
34 | { | ||
35 | return kmem_cache_alloc(zero_cache, GFP_KERNEL|__GFP_REPEAT); | ||
36 | } | ||
37 | |||
38 | static inline void | ||
39 | pmd_free(pmd_t *pmd) | ||
40 | { | ||
41 | kmem_cache_free(zero_cache, pmd); | ||
42 | } | ||
43 | |||
44 | #define pmd_populate_kernel(mm, pmd, pte) pmd_set(pmd, pte) | ||
45 | #define pmd_populate(mm, pmd, pte_page) \ | ||
46 | pmd_populate_kernel(mm, pmd, page_address(pte_page)) | ||
47 | |||
48 | static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm, unsigned long address) | ||
49 | { | ||
50 | return kmem_cache_alloc(zero_cache, GFP_KERNEL|__GFP_REPEAT); | ||
51 | } | ||
52 | |||
53 | static inline struct page *pte_alloc_one(struct mm_struct *mm, unsigned long address) | ||
54 | { | ||
55 | pte_t *pte = kmem_cache_alloc(zero_cache, GFP_KERNEL|__GFP_REPEAT); | ||
56 | if (pte) | ||
57 | return virt_to_page(pte); | ||
58 | return NULL; | ||
59 | } | ||
60 | |||
61 | static inline void pte_free_kernel(pte_t *pte) | ||
62 | { | ||
63 | kmem_cache_free(zero_cache, pte); | ||
64 | } | ||
65 | |||
66 | static inline void pte_free(struct page *ptepage) | ||
67 | { | ||
68 | kmem_cache_free(zero_cache, page_address(ptepage)); | ||
69 | } | ||
70 | |||
71 | struct pte_freelist_batch | ||
72 | { | ||
73 | struct rcu_head rcu; | ||
74 | unsigned int index; | ||
75 | struct page * pages[0]; | ||
76 | }; | ||
77 | |||
78 | #define PTE_FREELIST_SIZE ((PAGE_SIZE - sizeof(struct pte_freelist_batch)) / \ | ||
79 | sizeof(struct page *)) | ||
80 | |||
81 | extern void pte_free_now(struct page *ptepage); | ||
82 | extern void pte_free_submit(struct pte_freelist_batch *batch); | ||
83 | |||
84 | DECLARE_PER_CPU(struct pte_freelist_batch *, pte_freelist_cur); | ||
85 | |||
86 | void __pte_free_tlb(struct mmu_gather *tlb, struct page *ptepage); | ||
87 | #define __pmd_free_tlb(tlb, pmd) __pte_free_tlb(tlb, virt_to_page(pmd)) | ||
88 | |||
89 | #define check_pgt_cache() do { } while (0) | ||
90 | |||
91 | #endif /* _PPC64_PGALLOC_H */ | ||