1 #ifndef _ASM_IA64_PGALLOC_H
2 #define _ASM_IA64_PGALLOC_H
4 #define arch_add_exec_range(mm, limit) do { ; } while (0)
5 #define arch_flush_exec_range(mm) do { ; } while (0)
6 #define arch_remove_exec_range(mm, limit) do { ; } while (0)
9 * This file contains the functions and defines necessary to allocate
12 * This hopefully works with any (fixed) ia-64 page-size, as defined
13 * in <asm/page.h> (currently 8192).
15 * Copyright (C) 1998-2001 Hewlett-Packard Co
16 * David Mosberger-Tang <davidm@hpl.hp.com>
17 * Copyright (C) 2000, Goutham Rao <goutham.rao@intel.com>
20 #include <linux/config.h>
22 #include <linux/compiler.h>
24 #include <linux/page-flags.h>
25 #include <linux/threads.h>
27 #include <asm/mmu_context.h>
29 DECLARE_PER_CPU(unsigned long *, __pgtable_quicklist);
30 #define pgtable_quicklist __ia64_per_cpu_var(__pgtable_quicklist)
31 DECLARE_PER_CPU(long, __pgtable_quicklist_size);
32 #define pgtable_quicklist_size __ia64_per_cpu_var(__pgtable_quicklist_size)
34 static inline long pgtable_quicklist_total_size(void)
39 for_each_online_cpu(cpuid) {
40 ql_size += per_cpu(__pgtable_quicklist_size, cpuid);
45 static inline void *pgtable_quicklist_alloc(void)
47 unsigned long *ret = NULL;
51 ret = pgtable_quicklist;
52 if (likely(ret != NULL)) {
53 pgtable_quicklist = (unsigned long *)(*ret);
55 --pgtable_quicklist_size;
59 ret = (unsigned long *)__get_free_page(GFP_KERNEL | __GFP_ZERO);
65 static inline void pgtable_quicklist_free(void *pgtable_entry)
68 unsigned long nid = page_to_nid(virt_to_page(pgtable_entry));
70 if (unlikely(nid != numa_node_id())) {
71 free_page((unsigned long)pgtable_entry);
77 *(unsigned long *)pgtable_entry = (unsigned long)pgtable_quicklist;
78 pgtable_quicklist = (unsigned long *)pgtable_entry;
79 ++pgtable_quicklist_size;
83 static inline pgd_t *pgd_alloc(struct mm_struct *mm)
85 return pgtable_quicklist_alloc();
88 static inline void pgd_free(pgd_t * pgd)
90 pgtable_quicklist_free(pgd);
94 pud_populate(struct mm_struct *mm, pud_t * pud_entry, pmd_t * pmd)
96 pud_val(*pud_entry) = __pa(pmd);
99 static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long addr)
101 return pgtable_quicklist_alloc();
104 static inline void pmd_free(pmd_t * pmd)
106 pgtable_quicklist_free(pmd);
109 #define __pmd_free_tlb(tlb, pmd) pmd_free(pmd)
112 pmd_populate(struct mm_struct *mm, pmd_t * pmd_entry, struct page *pte)
114 pmd_val(*pmd_entry) = page_to_phys(pte);
118 pmd_populate_kernel(struct mm_struct *mm, pmd_t * pmd_entry, pte_t * pte)
120 pmd_val(*pmd_entry) = __pa(pte);
123 static inline struct page *pte_alloc_one(struct mm_struct *mm,
126 return virt_to_page(pgtable_quicklist_alloc());
129 static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm,
132 return pgtable_quicklist_alloc();
135 static inline void pte_free(struct page *pte)
137 pgtable_quicklist_free(page_address(pte));
140 static inline void pte_free_kernel(pte_t * pte)
142 pgtable_quicklist_free(pte);
145 #define __pte_free_tlb(tlb, pte) pte_free(pte)
147 extern void check_pgt_cache(void);
149 #endif /* _ASM_IA64_PGALLOC_H */