ia64/xen-unstable

view xen/include/asm-ia64/linux-xen/asm/pgalloc.h @ 9770:ced37bea0647

[IA64] FPH enabling + cleanup

Move contents of switch_to macro from xensystem.h to context_switch function.
Initialize FPU on all processors. FPH is always enabled in Xen.
Speed up context-switch (a little bit!) by not enabling/disabling FPH.
Cleanup (unused function/variablesi/fields, debug printf...)
vmx_ia64_switch_to removed (was unused).

Signed-off-by: Tristan Gingold <tristan.gingold@bull.net>
author awilliam@xenbuild.aw
date Tue Apr 25 22:35:41 2006 -0600 (2006-04-25)
parents 1055f276cc4d
children 666bc6079577
line source
1 #ifndef _ASM_IA64_PGALLOC_H
2 #define _ASM_IA64_PGALLOC_H
4 /*
5 * This file contains the functions and defines necessary to allocate
6 * page tables.
7 *
8 * This hopefully works with any (fixed) ia-64 page-size, as defined
9 * in <asm/page.h> (currently 8192).
10 *
11 * Copyright (C) 1998-2001 Hewlett-Packard Co
12 * David Mosberger-Tang <davidm@hpl.hp.com>
13 * Copyright (C) 2000, Goutham Rao <goutham.rao@intel.com>
14 */
16 #include <linux/config.h>
18 #include <linux/compiler.h>
19 #include <linux/mm.h>
20 #include <linux/page-flags.h>
21 #include <linux/threads.h>
23 #include <asm/mmu_context.h>
25 #ifndef XEN
26 DECLARE_PER_CPU(unsigned long *, __pgtable_quicklist);
27 #define pgtable_quicklist __ia64_per_cpu_var(__pgtable_quicklist)
28 DECLARE_PER_CPU(long, __pgtable_quicklist_size);
29 #define pgtable_quicklist_size __ia64_per_cpu_var(__pgtable_quicklist_size)
31 static inline long pgtable_quicklist_total_size(void)
32 {
33 long ql_size = 0;
34 int cpuid;
36 for_each_online_cpu(cpuid) {
37 ql_size += per_cpu(__pgtable_quicklist_size, cpuid);
38 }
39 return ql_size;
40 }
42 static inline void *pgtable_quicklist_alloc(void)
43 {
44 unsigned long *ret = NULL;
46 preempt_disable();
48 ret = pgtable_quicklist;
49 if (likely(ret != NULL)) {
50 pgtable_quicklist = (unsigned long *)(*ret);
51 ret[0] = 0;
52 --pgtable_quicklist_size;
53 preempt_enable();
54 } else {
55 preempt_enable();
56 ret = (unsigned long *)__get_free_page(GFP_KERNEL | __GFP_ZERO);
57 }
59 return ret;
60 }
62 static inline void pgtable_quicklist_free(void *pgtable_entry)
63 {
64 #ifdef CONFIG_NUMA
65 unsigned long nid = page_to_nid(virt_to_page(pgtable_entry));
67 if (unlikely(nid != numa_node_id())) {
68 free_page((unsigned long)pgtable_entry);
69 return;
70 }
71 #endif
73 preempt_disable();
74 *(unsigned long *)pgtable_entry = (unsigned long)pgtable_quicklist;
75 pgtable_quicklist = (unsigned long *)pgtable_entry;
76 ++pgtable_quicklist_size;
77 preempt_enable();
78 }
79 #endif
81 static inline pgd_t *pgd_alloc(struct mm_struct *mm)
82 {
83 return pgtable_quicklist_alloc();
84 }
86 static inline void pgd_free(pgd_t * pgd)
87 {
88 pgtable_quicklist_free(pgd);
89 }
91 static inline void
92 pud_populate(struct mm_struct *mm, pud_t * pud_entry, pmd_t * pmd)
93 {
94 pud_val(*pud_entry) = __pa(pmd);
95 }
97 static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long addr)
98 {
99 return pgtable_quicklist_alloc();
100 }
102 static inline void pmd_free(pmd_t * pmd)
103 {
104 pgtable_quicklist_free(pmd);
105 }
107 #define __pmd_free_tlb(tlb, pmd) pmd_free(pmd)
109 #ifndef XEN
110 static inline void
111 pmd_populate(struct mm_struct *mm, pmd_t * pmd_entry, struct page *pte)
112 {
113 pmd_val(*pmd_entry) = page_to_maddr(pte);
114 }
115 #endif
117 static inline void
118 pmd_populate_kernel(struct mm_struct *mm, pmd_t * pmd_entry, pte_t * pte)
119 {
120 pmd_val(*pmd_entry) = __pa(pte);
121 }
123 #ifndef XEN
124 static inline struct page *pte_alloc_one(struct mm_struct *mm,
125 unsigned long addr)
126 {
127 return virt_to_page(pgtable_quicklist_alloc());
128 }
129 #endif
131 static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm,
132 unsigned long addr)
133 {
134 return pgtable_quicklist_alloc();
135 }
137 #ifndef XEN
138 static inline void pte_free(struct page *pte)
139 {
140 pgtable_quicklist_free(page_address(pte));
141 }
143 static inline void pte_free_kernel(pte_t * pte)
144 {
145 pgtable_quicklist_free(pte);
146 }
148 #define __pte_free_tlb(tlb, pte) pte_free(pte)
149 #endif
151 extern void check_pgt_cache(void);
153 #endif /* _ASM_IA64_PGALLOC_H */