diff options
author | Jeremy Fitzhardinge <jeremy@goop.org> | 2008-01-30 07:33:39 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-01-30 07:33:39 -0500 |
commit | a5a19c63f4e55e32dc0bc3d936d7f94793d8b380 (patch) | |
tree | 3aaf621cd79889ed2658de2c30fa2fea42c86cf5 /include | |
parent | 6c435456dc91ace468b4e9d72ad0e13dafa22a45 (diff) |
x86: demacro asm-x86/pgalloc_32.h
Convert macros into inline functions, for better type-checking.
This patch required a little bit of fiddling with headers in order to
make __(pte|pmd)_free_tlb inline rather than macros.
asm-generic/tlb.h includes asm/pgalloc.h, though it doesn't directly
use any pgalloc definitions. I removed this include to avoid an
include cycle, but it may cause secondary compile failures by things
depending on the indirect inclusion; arch/x86/mm/hugetlbpage.c was one
such place; there may be others.
Signed-off-by: Jeremy Fitzhardinge <jeremy@xensource.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'include')
-rw-r--r-- | include/asm-generic/tlb.h | 1 | ||||
-rw-r--r-- | include/asm-x86/pgalloc_32.h | 61 | ||||
-rw-r--r-- | include/asm-x86/pgtable-3level.h | 2 | ||||
-rw-r--r-- | include/linux/swap.h | 1 |
4 files changed, 40 insertions, 25 deletions
diff --git a/include/asm-generic/tlb.h b/include/asm-generic/tlb.h index 75f2bfab614f..6ce9f3ab928d 100644 --- a/include/asm-generic/tlb.h +++ b/include/asm-generic/tlb.h | |||
@@ -15,7 +15,6 @@ | |||
15 | 15 | ||
16 | #include <linux/swap.h> | 16 | #include <linux/swap.h> |
17 | #include <linux/quicklist.h> | 17 | #include <linux/quicklist.h> |
18 | #include <asm/pgalloc.h> | ||
19 | #include <asm/tlbflush.h> | 18 | #include <asm/tlbflush.h> |
20 | 19 | ||
21 | /* | 20 | /* |
diff --git a/include/asm-x86/pgalloc_32.h b/include/asm-x86/pgalloc_32.h index fbc6357f5eba..3482c3427897 100644 --- a/include/asm-x86/pgalloc_32.h +++ b/include/asm-x86/pgalloc_32.h | |||
@@ -3,6 +3,8 @@ | |||
3 | 3 | ||
4 | #include <linux/threads.h> | 4 | #include <linux/threads.h> |
5 | #include <linux/mm.h> /* for struct page */ | 5 | #include <linux/mm.h> /* for struct page */ |
6 | #include <asm/tlb.h> | ||
7 | #include <asm-generic/tlb.h> | ||
6 | 8 | ||
7 | #ifdef CONFIG_PARAVIRT | 9 | #ifdef CONFIG_PARAVIRT |
8 | #include <asm/paravirt.h> | 10 | #include <asm/paravirt.h> |
@@ -14,19 +16,20 @@ | |||
14 | #define paravirt_release_pd(pfn) do { } while (0) | 16 | #define paravirt_release_pd(pfn) do { } while (0) |
15 | #endif | 17 | #endif |
16 | 18 | ||
17 | #define pmd_populate_kernel(mm, pmd, pte) \ | 19 | static inline void pmd_populate_kernel(struct mm_struct *mm, |
18 | do { \ | 20 | pmd_t *pmd, pte_t *pte) |
19 | paravirt_alloc_pt(mm, __pa(pte) >> PAGE_SHIFT); \ | 21 | { |
20 | set_pmd(pmd, __pmd(_PAGE_TABLE + __pa(pte))); \ | 22 | paravirt_alloc_pt(mm, __pa(pte) >> PAGE_SHIFT); |
21 | } while (0) | 23 | set_pmd(pmd, __pmd(__pa(pte) | _PAGE_TABLE)); |
24 | } | ||
22 | 25 | ||
23 | #define pmd_populate(mm, pmd, pte) \ | 26 | static inline void pmd_populate(struct mm_struct *mm, pmd_t *pmd, struct page *pte) |
24 | do { \ | 27 | { |
25 | paravirt_alloc_pt(mm, page_to_pfn(pte)); \ | 28 | unsigned long pfn = page_to_pfn(pte); |
26 | set_pmd(pmd, __pmd(_PAGE_TABLE + \ | 29 | |
27 | ((unsigned long long)page_to_pfn(pte) << \ | 30 | paravirt_alloc_pt(mm, pfn); |
28 | (unsigned long long) PAGE_SHIFT))); \ | 31 | set_pmd(pmd, __pmd(((pteval_t)pfn << PAGE_SHIFT) | _PAGE_TABLE)); |
29 | } while (0) | 32 | } |
30 | 33 | ||
31 | /* | 34 | /* |
32 | * Allocate and free page tables. | 35 | * Allocate and free page tables. |
@@ -48,20 +51,34 @@ static inline void pte_free(struct page *pte) | |||
48 | } | 51 | } |
49 | 52 | ||
50 | 53 | ||
51 | #define __pte_free_tlb(tlb,pte) \ | 54 | static inline void __pte_free_tlb(struct mmu_gather *tlb, struct page *pte) |
52 | do { \ | 55 | { |
53 | paravirt_release_pt(page_to_pfn(pte)); \ | 56 | paravirt_release_pt(page_to_pfn(pte)); |
54 | tlb_remove_page((tlb),(pte)); \ | 57 | tlb_remove_page(tlb, pte); |
55 | } while (0) | 58 | } |
56 | 59 | ||
57 | #ifdef CONFIG_X86_PAE | 60 | #ifdef CONFIG_X86_PAE |
58 | /* | 61 | /* |
59 | * In the PAE case we free the pmds as part of the pgd. | 62 | * In the PAE case we free the pmds as part of the pgd. |
60 | */ | 63 | */ |
61 | #define pmd_alloc_one(mm, addr) ({ BUG(); ((pmd_t *)2); }) | 64 | static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long addr) |
62 | #define pmd_free(x) do { } while (0) | 65 | { |
63 | #define __pmd_free_tlb(tlb,x) do { } while (0) | 66 | BUG(); |
64 | #define pud_populate(mm, pmd, pte) BUG() | 67 | return (pmd_t *)2; |
65 | #endif | 68 | } |
69 | |||
70 | static inline void pmd_free(pmd_t *pmd) | ||
71 | { | ||
72 | } | ||
73 | |||
74 | static inline void __pmd_free_tlb(struct mmu_gather *tlb, pmd_t *pmd) | ||
75 | { | ||
76 | } | ||
77 | |||
78 | static inline void pud_populate(struct mm_struct *mm, pud_t *pud, pmd_t *pmd) | ||
79 | { | ||
80 | BUG(); | ||
81 | } | ||
82 | #endif /* CONFIG_X86_PAE */ | ||
66 | 83 | ||
67 | #endif /* _I386_PGALLOC_H */ | 84 | #endif /* _I386_PGALLOC_H */ |
diff --git a/include/asm-x86/pgtable-3level.h b/include/asm-x86/pgtable-3level.h index 5af7a44ed902..62bb06575d5a 100644 --- a/include/asm-x86/pgtable-3level.h +++ b/include/asm-x86/pgtable-3level.h | |||
@@ -157,6 +157,4 @@ static inline unsigned long pte_pfn(pte_t pte) | |||
157 | #define __pte_to_swp_entry(pte) ((swp_entry_t){ (pte).pte_high }) | 157 | #define __pte_to_swp_entry(pte) ((swp_entry_t){ (pte).pte_high }) |
158 | #define __swp_entry_to_pte(x) ((pte_t){ { .pte_high = (x).val } }) | 158 | #define __swp_entry_to_pte(x) ((pte_t){ { .pte_high = (x).val } }) |
159 | 159 | ||
160 | #define __pmd_free_tlb(tlb, x) do { } while (0) | ||
161 | |||
162 | #endif /* _I386_PGTABLE_3LEVEL_H */ | 160 | #endif /* _I386_PGTABLE_3LEVEL_H */ |
diff --git a/include/linux/swap.h b/include/linux/swap.h index 4f3838adbb30..2c3ce4c69b25 100644 --- a/include/linux/swap.h +++ b/include/linux/swap.h | |||
@@ -6,6 +6,7 @@ | |||
6 | #include <linux/mmzone.h> | 6 | #include <linux/mmzone.h> |
7 | #include <linux/list.h> | 7 | #include <linux/list.h> |
8 | #include <linux/sched.h> | 8 | #include <linux/sched.h> |
9 | #include <linux/pagemap.h> | ||
9 | 10 | ||
10 | #include <asm/atomic.h> | 11 | #include <asm/atomic.h> |
11 | #include <asm/page.h> | 12 | #include <asm/page.h> |