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;
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.
19 pgd_alloc(struct mm_struct *mm)
21 return kmem_cache_alloc(zero_cache, GFP_KERNEL);
27 kmem_cache_free(zero_cache, pgd);
30 #define pud_populate(MM, PUD, PMD) pud_set(PUD, PMD)
33 pmd_alloc_one(struct mm_struct *mm, unsigned long addr)
35 return kmem_cache_alloc(zero_cache, GFP_KERNEL|__GFP_REPEAT);
41 kmem_cache_free(zero_cache, pmd);
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))
48 static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm, unsigned long address)
50 return kmem_cache_alloc(zero_cache, GFP_KERNEL|__GFP_REPEAT);
53 static inline struct page *pte_alloc_one(struct mm_struct *mm, unsigned long address)
55 pte_t *pte = kmem_cache_alloc(zero_cache, GFP_KERNEL|__GFP_REPEAT);
57 return virt_to_page(pte);
61 static inline void pte_free_kernel(pte_t *pte)
63 kmem_cache_free(zero_cache, pte);
66 static inline void pte_free(struct page *ptepage)
68 kmem_cache_free(zero_cache, page_address(ptepage));
71 struct pte_freelist_batch
75 struct page * pages[0];
78 #define PTE_FREELIST_SIZE ((PAGE_SIZE - sizeof(struct pte_freelist_batch)) / \
79 sizeof(struct page *))
81 extern void pte_free_now(struct page *ptepage);
82 extern void pte_free_submit(struct pte_freelist_batch *batch);
84 DECLARE_PER_CPU(struct pte_freelist_batch *, pte_freelist_cur);
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))
89 #define check_pgt_cache() do { } while (0)
91 #endif /* _PPC64_PGALLOC_H */