diff options
-rw-r--r-- | include/asm-ia64/hugetlb.h | 37 | ||||
-rw-r--r-- | include/asm-ia64/page.h | 6 | ||||
-rw-r--r-- | include/asm-powerpc/hugetlb.h | 37 | ||||
-rw-r--r-- | include/asm-powerpc/page_64.h | 7 | ||||
-rw-r--r-- | include/asm-sh/hugetlb.h | 49 | ||||
-rw-r--r-- | include/asm-sparc64/hugetlb.h | 42 | ||||
-rw-r--r-- | include/asm-sparc64/page.h | 2 | ||||
-rw-r--r-- | include/asm-x86/hugetlb.h | 49 | ||||
-rw-r--r-- | include/linux/hugetlb.h | 46 |
9 files changed, 215 insertions, 60 deletions
diff --git a/include/asm-ia64/hugetlb.h b/include/asm-ia64/hugetlb.h new file mode 100644 index 000000000000..f0ee14c6e172 --- /dev/null +++ b/include/asm-ia64/hugetlb.h | |||
@@ -0,0 +1,37 @@ | |||
1 | #ifndef _ASM_IA64_HUGETLB_H | ||
2 | #define _ASM_IA64_HUGETLB_H | ||
3 | |||
4 | #include <asm/page.h> | ||
5 | |||
6 | |||
7 | void hugetlb_free_pgd_range(struct mmu_gather **tlb, unsigned long addr, | ||
8 | unsigned long end, unsigned long floor, | ||
9 | unsigned long ceiling); | ||
10 | |||
11 | int prepare_hugepage_range(unsigned long addr, unsigned long len); | ||
12 | |||
13 | static inline int is_hugepage_only_range(struct mm_struct *mm, | ||
14 | unsigned long addr, | ||
15 | unsigned long len) | ||
16 | { | ||
17 | return (REGION_NUMBER(addr) == RGN_HPAGE || | ||
18 | REGION_NUMBER((addr)+(len)-1) == RGN_HPAGE); | ||
19 | } | ||
20 | |||
21 | static inline void hugetlb_prefault_arch_hook(struct mm_struct *mm) | ||
22 | { | ||
23 | } | ||
24 | |||
25 | static inline void set_huge_pte_at(struct mm_struct *mm, unsigned long addr, | ||
26 | pte_t *ptep, pte_t pte) | ||
27 | { | ||
28 | set_pte_at(mm, addr, ptep, pte); | ||
29 | } | ||
30 | |||
31 | static inline pte_t huge_ptep_get_and_clear(struct mm_struct *mm, | ||
32 | unsigned long addr, pte_t *ptep) | ||
33 | { | ||
34 | return ptep_get_and_clear(mm, addr, ptep); | ||
35 | } | ||
36 | |||
37 | #endif /* _ASM_IA64_HUGETLB_H */ | ||
diff --git a/include/asm-ia64/page.h b/include/asm-ia64/page.h index 4999a6c63775..36f39321b768 100644 --- a/include/asm-ia64/page.h +++ b/include/asm-ia64/page.h | |||
@@ -54,9 +54,6 @@ | |||
54 | # define HPAGE_MASK (~(HPAGE_SIZE - 1)) | 54 | # define HPAGE_MASK (~(HPAGE_SIZE - 1)) |
55 | 55 | ||
56 | # define HAVE_ARCH_HUGETLB_UNMAPPED_AREA | 56 | # define HAVE_ARCH_HUGETLB_UNMAPPED_AREA |
57 | # define ARCH_HAS_HUGEPAGE_ONLY_RANGE | ||
58 | # define ARCH_HAS_PREPARE_HUGEPAGE_RANGE | ||
59 | # define ARCH_HAS_HUGETLB_FREE_PGD_RANGE | ||
60 | #endif /* CONFIG_HUGETLB_PAGE */ | 57 | #endif /* CONFIG_HUGETLB_PAGE */ |
61 | 58 | ||
62 | #ifdef __ASSEMBLY__ | 59 | #ifdef __ASSEMBLY__ |
@@ -153,9 +150,6 @@ typedef union ia64_va { | |||
153 | # define htlbpage_to_page(x) (((unsigned long) REGION_NUMBER(x) << 61) \ | 150 | # define htlbpage_to_page(x) (((unsigned long) REGION_NUMBER(x) << 61) \ |
154 | | (REGION_OFFSET(x) >> (HPAGE_SHIFT-PAGE_SHIFT))) | 151 | | (REGION_OFFSET(x) >> (HPAGE_SHIFT-PAGE_SHIFT))) |
155 | # define HUGETLB_PAGE_ORDER (HPAGE_SHIFT - PAGE_SHIFT) | 152 | # define HUGETLB_PAGE_ORDER (HPAGE_SHIFT - PAGE_SHIFT) |
156 | # define is_hugepage_only_range(mm, addr, len) \ | ||
157 | (REGION_NUMBER(addr) == RGN_HPAGE || \ | ||
158 | REGION_NUMBER((addr)+(len)-1) == RGN_HPAGE) | ||
159 | extern unsigned int hpage_shift; | 153 | extern unsigned int hpage_shift; |
160 | #endif | 154 | #endif |
161 | 155 | ||
diff --git a/include/asm-powerpc/hugetlb.h b/include/asm-powerpc/hugetlb.h new file mode 100644 index 000000000000..f537993c5c87 --- /dev/null +++ b/include/asm-powerpc/hugetlb.h | |||
@@ -0,0 +1,37 @@ | |||
1 | #ifndef _ASM_POWERPC_HUGETLB_H | ||
2 | #define _ASM_POWERPC_HUGETLB_H | ||
3 | |||
4 | #include <asm/page.h> | ||
5 | |||
6 | |||
7 | int is_hugepage_only_range(struct mm_struct *mm, unsigned long addr, | ||
8 | unsigned long len); | ||
9 | |||
10 | void hugetlb_free_pgd_range(struct mmu_gather **tlb, unsigned long addr, | ||
11 | unsigned long end, unsigned long floor, | ||
12 | unsigned long ceiling); | ||
13 | |||
14 | void set_huge_pte_at(struct mm_struct *mm, unsigned long addr, | ||
15 | pte_t *ptep, pte_t pte); | ||
16 | |||
17 | pte_t huge_ptep_get_and_clear(struct mm_struct *mm, unsigned long addr, | ||
18 | pte_t *ptep); | ||
19 | |||
20 | /* | ||
21 | * If the arch doesn't supply something else, assume that hugepage | ||
22 | * size aligned regions are ok without further preparation. | ||
23 | */ | ||
24 | static inline int prepare_hugepage_range(unsigned long addr, unsigned long len) | ||
25 | { | ||
26 | if (len & ~HPAGE_MASK) | ||
27 | return -EINVAL; | ||
28 | if (addr & ~HPAGE_MASK) | ||
29 | return -EINVAL; | ||
30 | return 0; | ||
31 | } | ||
32 | |||
33 | static inline void hugetlb_prefault_arch_hook(struct mm_struct *mm) | ||
34 | { | ||
35 | } | ||
36 | |||
37 | #endif /* _ASM_POWERPC_HUGETLB_H */ | ||
diff --git a/include/asm-powerpc/page_64.h b/include/asm-powerpc/page_64.h index 67834eae5702..25af4fc8daf4 100644 --- a/include/asm-powerpc/page_64.h +++ b/include/asm-powerpc/page_64.h | |||
@@ -128,11 +128,6 @@ extern void slice_init_context(struct mm_struct *mm, unsigned int psize); | |||
128 | extern void slice_set_user_psize(struct mm_struct *mm, unsigned int psize); | 128 | extern void slice_set_user_psize(struct mm_struct *mm, unsigned int psize); |
129 | #define slice_mm_new_context(mm) ((mm)->context.id == 0) | 129 | #define slice_mm_new_context(mm) ((mm)->context.id == 0) |
130 | 130 | ||
131 | #define ARCH_HAS_HUGEPAGE_ONLY_RANGE | ||
132 | extern int is_hugepage_only_range(struct mm_struct *m, | ||
133 | unsigned long addr, | ||
134 | unsigned long len); | ||
135 | |||
136 | #endif /* __ASSEMBLY__ */ | 131 | #endif /* __ASSEMBLY__ */ |
137 | #else | 132 | #else |
138 | #define slice_init() | 133 | #define slice_init() |
@@ -146,8 +141,6 @@ do { \ | |||
146 | 141 | ||
147 | #ifdef CONFIG_HUGETLB_PAGE | 142 | #ifdef CONFIG_HUGETLB_PAGE |
148 | 143 | ||
149 | #define ARCH_HAS_HUGETLB_FREE_PGD_RANGE | ||
150 | #define ARCH_HAS_SETCLEAR_HUGE_PTE | ||
151 | #define HAVE_ARCH_HUGETLB_UNMAPPED_AREA | 144 | #define HAVE_ARCH_HUGETLB_UNMAPPED_AREA |
152 | 145 | ||
153 | #endif /* !CONFIG_HUGETLB_PAGE */ | 146 | #endif /* !CONFIG_HUGETLB_PAGE */ |
diff --git a/include/asm-sh/hugetlb.h b/include/asm-sh/hugetlb.h new file mode 100644 index 000000000000..885218d2c844 --- /dev/null +++ b/include/asm-sh/hugetlb.h | |||
@@ -0,0 +1,49 @@ | |||
1 | #ifndef _ASM_SH_HUGETLB_H | ||
2 | #define _ASM_SH_HUGETLB_H | ||
3 | |||
4 | #include <asm/page.h> | ||
5 | |||
6 | |||
7 | static inline int is_hugepage_only_range(struct mm_struct *mm, | ||
8 | unsigned long addr, | ||
9 | unsigned long len) { | ||
10 | return 0; | ||
11 | } | ||
12 | |||
13 | /* | ||
14 | * If the arch doesn't supply something else, assume that hugepage | ||
15 | * size aligned regions are ok without further preparation. | ||
16 | */ | ||
17 | static inline int prepare_hugepage_range(unsigned long addr, unsigned long len) | ||
18 | { | ||
19 | if (len & ~HPAGE_MASK) | ||
20 | return -EINVAL; | ||
21 | if (addr & ~HPAGE_MASK) | ||
22 | return -EINVAL; | ||
23 | return 0; | ||
24 | } | ||
25 | |||
26 | static inline void hugetlb_prefault_arch_hook(struct mm_struct *mm) { | ||
27 | } | ||
28 | |||
29 | static inline void hugetlb_free_pgd_range(struct mmu_gather **tlb, | ||
30 | unsigned long addr, unsigned long end, | ||
31 | unsigned long floor, | ||
32 | unsigned long ceiling) | ||
33 | { | ||
34 | free_pgd_range(tlb, addr, end, floor, ceiling); | ||
35 | } | ||
36 | |||
37 | static inline void set_huge_pte_at(struct mm_struct *mm, unsigned long addr, | ||
38 | pte_t *ptep, pte_t pte) | ||
39 | { | ||
40 | set_pte_at(mm, addr, ptep, pte); | ||
41 | } | ||
42 | |||
43 | static inline pte_t huge_ptep_get_and_clear(struct mm_struct *mm, | ||
44 | unsigned long addr, pte_t *ptep) | ||
45 | { | ||
46 | return ptep_get_and_clear(mm, addr, ptep); | ||
47 | } | ||
48 | |||
49 | #endif /* _ASM_SH_HUGETLB_H */ | ||
diff --git a/include/asm-sparc64/hugetlb.h b/include/asm-sparc64/hugetlb.h new file mode 100644 index 000000000000..7e111cfd31ea --- /dev/null +++ b/include/asm-sparc64/hugetlb.h | |||
@@ -0,0 +1,42 @@ | |||
1 | #ifndef _ASM_SPARC64_HUGETLB_H | ||
2 | #define _ASM_SPARC64_HUGETLB_H | ||
3 | |||
4 | #include <asm/page.h> | ||
5 | |||
6 | |||
7 | void set_huge_pte_at(struct mm_struct *mm, unsigned long addr, | ||
8 | pte_t *ptep, pte_t pte); | ||
9 | |||
10 | pte_t huge_ptep_get_and_clear(struct mm_struct *mm, unsigned long addr, | ||
11 | pte_t *ptep); | ||
12 | |||
13 | void hugetlb_prefault_arch_hook(struct mm_struct *mm); | ||
14 | |||
15 | static inline int is_hugepage_only_range(struct mm_struct *mm, | ||
16 | unsigned long addr, | ||
17 | unsigned long len) { | ||
18 | return 0; | ||
19 | } | ||
20 | |||
21 | /* | ||
22 | * If the arch doesn't supply something else, assume that hugepage | ||
23 | * size aligned regions are ok without further preparation. | ||
24 | */ | ||
25 | static inline int prepare_hugepage_range(unsigned long addr, unsigned long len) | ||
26 | { | ||
27 | if (len & ~HPAGE_MASK) | ||
28 | return -EINVAL; | ||
29 | if (addr & ~HPAGE_MASK) | ||
30 | return -EINVAL; | ||
31 | return 0; | ||
32 | } | ||
33 | |||
34 | static inline void hugetlb_free_pgd_range(struct mmu_gather **tlb, | ||
35 | unsigned long addr, unsigned long end, | ||
36 | unsigned long floor, | ||
37 | unsigned long ceiling) | ||
38 | { | ||
39 | free_pgd_range(tlb, addr, end, floor, ceiling); | ||
40 | } | ||
41 | |||
42 | #endif /* _ASM_SPARC64_HUGETLB_H */ | ||
diff --git a/include/asm-sparc64/page.h b/include/asm-sparc64/page.h index e93a482aa24a..618117def0dc 100644 --- a/include/asm-sparc64/page.h +++ b/include/asm-sparc64/page.h | |||
@@ -39,8 +39,6 @@ | |||
39 | #define HPAGE_SIZE (_AC(1,UL) << HPAGE_SHIFT) | 39 | #define HPAGE_SIZE (_AC(1,UL) << HPAGE_SHIFT) |
40 | #define HPAGE_MASK (~(HPAGE_SIZE - 1UL)) | 40 | #define HPAGE_MASK (~(HPAGE_SIZE - 1UL)) |
41 | #define HUGETLB_PAGE_ORDER (HPAGE_SHIFT - PAGE_SHIFT) | 41 | #define HUGETLB_PAGE_ORDER (HPAGE_SHIFT - PAGE_SHIFT) |
42 | #define ARCH_HAS_SETCLEAR_HUGE_PTE | ||
43 | #define ARCH_HAS_HUGETLB_PREFAULT_HOOK | ||
44 | #define HAVE_ARCH_HUGETLB_UNMAPPED_AREA | 42 | #define HAVE_ARCH_HUGETLB_UNMAPPED_AREA |
45 | #endif | 43 | #endif |
46 | 44 | ||
diff --git a/include/asm-x86/hugetlb.h b/include/asm-x86/hugetlb.h new file mode 100644 index 000000000000..ec21cedd7149 --- /dev/null +++ b/include/asm-x86/hugetlb.h | |||
@@ -0,0 +1,49 @@ | |||
1 | #ifndef _ASM_X86_HUGETLB_H | ||
2 | #define _ASM_X86_HUGETLB_H | ||
3 | |||
4 | #include <asm/page.h> | ||
5 | |||
6 | |||
7 | static inline int is_hugepage_only_range(struct mm_struct *mm, | ||
8 | unsigned long addr, | ||
9 | unsigned long len) { | ||
10 | return 0; | ||
11 | } | ||
12 | |||
13 | /* | ||
14 | * If the arch doesn't supply something else, assume that hugepage | ||
15 | * size aligned regions are ok without further preparation. | ||
16 | */ | ||
17 | static inline int prepare_hugepage_range(unsigned long addr, unsigned long len) | ||
18 | { | ||
19 | if (len & ~HPAGE_MASK) | ||
20 | return -EINVAL; | ||
21 | if (addr & ~HPAGE_MASK) | ||
22 | return -EINVAL; | ||
23 | return 0; | ||
24 | } | ||
25 | |||
26 | static inline void hugetlb_prefault_arch_hook(struct mm_struct *mm) { | ||
27 | } | ||
28 | |||
29 | static inline void hugetlb_free_pgd_range(struct mmu_gather **tlb, | ||
30 | unsigned long addr, unsigned long end, | ||
31 | unsigned long floor, | ||
32 | unsigned long ceiling) | ||
33 | { | ||
34 | free_pgd_range(tlb, addr, end, floor, ceiling); | ||
35 | } | ||
36 | |||
37 | static inline void set_huge_pte_at(struct mm_struct *mm, unsigned long addr, | ||
38 | pte_t *ptep, pte_t pte) | ||
39 | { | ||
40 | set_pte_at(mm, addr, ptep, pte); | ||
41 | } | ||
42 | |||
43 | static inline pte_t huge_ptep_get_and_clear(struct mm_struct *mm, | ||
44 | unsigned long addr, pte_t *ptep) | ||
45 | { | ||
46 | return ptep_get_and_clear(mm, addr, ptep); | ||
47 | } | ||
48 | |||
49 | #endif /* _ASM_X86_HUGETLB_H */ | ||
diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h index addca4cd4f11..a79e80b689d8 100644 --- a/include/linux/hugetlb.h +++ b/include/linux/hugetlb.h | |||
@@ -8,6 +8,7 @@ | |||
8 | #include <linux/mempolicy.h> | 8 | #include <linux/mempolicy.h> |
9 | #include <linux/shm.h> | 9 | #include <linux/shm.h> |
10 | #include <asm/tlbflush.h> | 10 | #include <asm/tlbflush.h> |
11 | #include <asm/hugetlb.h> | ||
11 | 12 | ||
12 | struct ctl_table; | 13 | struct ctl_table; |
13 | 14 | ||
@@ -51,51 +52,6 @@ int pmd_huge(pmd_t pmd); | |||
51 | void hugetlb_change_protection(struct vm_area_struct *vma, | 52 | void hugetlb_change_protection(struct vm_area_struct *vma, |
52 | unsigned long address, unsigned long end, pgprot_t newprot); | 53 | unsigned long address, unsigned long end, pgprot_t newprot); |
53 | 54 | ||
54 | #ifndef ARCH_HAS_HUGEPAGE_ONLY_RANGE | ||
55 | #define is_hugepage_only_range(mm, addr, len) 0 | ||
56 | #endif | ||
57 | |||
58 | #ifndef ARCH_HAS_HUGETLB_FREE_PGD_RANGE | ||
59 | #define hugetlb_free_pgd_range free_pgd_range | ||
60 | #else | ||
61 | void hugetlb_free_pgd_range(struct mmu_gather **tlb, unsigned long addr, | ||
62 | unsigned long end, unsigned long floor, | ||
63 | unsigned long ceiling); | ||
64 | #endif | ||
65 | |||
66 | #ifndef ARCH_HAS_PREPARE_HUGEPAGE_RANGE | ||
67 | /* | ||
68 | * If the arch doesn't supply something else, assume that hugepage | ||
69 | * size aligned regions are ok without further preparation. | ||
70 | */ | ||
71 | static inline int prepare_hugepage_range(unsigned long addr, unsigned long len) | ||
72 | { | ||
73 | if (len & ~HPAGE_MASK) | ||
74 | return -EINVAL; | ||
75 | if (addr & ~HPAGE_MASK) | ||
76 | return -EINVAL; | ||
77 | return 0; | ||
78 | } | ||
79 | #else | ||
80 | int prepare_hugepage_range(unsigned long addr, unsigned long len); | ||
81 | #endif | ||
82 | |||
83 | #ifndef ARCH_HAS_SETCLEAR_HUGE_PTE | ||
84 | #define set_huge_pte_at(mm, addr, ptep, pte) set_pte_at(mm, addr, ptep, pte) | ||
85 | #define huge_ptep_get_and_clear(mm, addr, ptep) ptep_get_and_clear(mm, addr, ptep) | ||
86 | #else | ||
87 | void set_huge_pte_at(struct mm_struct *mm, unsigned long addr, | ||
88 | pte_t *ptep, pte_t pte); | ||
89 | pte_t huge_ptep_get_and_clear(struct mm_struct *mm, unsigned long addr, | ||
90 | pte_t *ptep); | ||
91 | #endif | ||
92 | |||
93 | #ifndef ARCH_HAS_HUGETLB_PREFAULT_HOOK | ||
94 | #define hugetlb_prefault_arch_hook(mm) do { } while (0) | ||
95 | #else | ||
96 | void hugetlb_prefault_arch_hook(struct mm_struct *mm); | ||
97 | #endif | ||
98 | |||
99 | #else /* !CONFIG_HUGETLB_PAGE */ | 55 | #else /* !CONFIG_HUGETLB_PAGE */ |
100 | 56 | ||
101 | static inline int is_vm_hugetlb_page(struct vm_area_struct *vma) | 57 | static inline int is_vm_hugetlb_page(struct vm_area_struct *vma) |