1 #ifndef _PPC64_PGALLOC_H
2 #define _PPC64_PGALLOC_H
5 #include <linux/slab.h>
6 #include <linux/cpumask.h>
7 #include <linux/percpu.h>
9 extern kmem_cache_t *zero_cache;
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)
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.
24 pgd_alloc(struct mm_struct *mm)
26 return kmem_cache_alloc(zero_cache, GFP_KERNEL);
32 kmem_cache_free(zero_cache, pgd);
35 #define pud_populate(MM, PUD, PMD) pud_set(PUD, PMD)
38 pmd_alloc_one(struct mm_struct *mm, unsigned long addr)
40 return kmem_cache_alloc(zero_cache, GFP_KERNEL|__GFP_REPEAT);
46 kmem_cache_free(zero_cache, pmd);
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))
53 static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm, unsigned long address)
55 return kmem_cache_alloc(zero_cache, GFP_KERNEL|__GFP_REPEAT);
58 static inline struct page *pte_alloc_one(struct mm_struct *mm, unsigned long address)
60 pte_t *pte = kmem_cache_alloc(zero_cache, GFP_KERNEL|__GFP_REPEAT);
62 return virt_to_page(pte);
66 static inline void pte_free_kernel(pte_t *pte)
68 kmem_cache_free(zero_cache, pte);
71 static inline void pte_free(struct page *ptepage)
73 kmem_cache_free(zero_cache, page_address(ptepage));
76 struct pte_freelist_batch
80 struct page * pages[0];
83 #define PTE_FREELIST_SIZE ((PAGE_SIZE - sizeof(struct pte_freelist_batch)) / \
84 sizeof(struct page *))
86 extern void pte_free_now(struct page *ptepage);
87 extern void pte_free_submit(struct pte_freelist_batch *batch);
89 DECLARE_PER_CPU(struct pte_freelist_batch *, pte_freelist_cur);
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))
94 #define check_pgt_cache() do { } while (0)
96 #endif /* _PPC64_PGALLOC_H */