diff options
author | Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> | 2014-11-05 11:27:41 -0500 |
---|---|---|
committer | Michael Ellerman <mpe@ellerman.id.au> | 2014-11-14 01:24:21 -0500 |
commit | b30e759072c182538abb6908681cfd49978ba5e2 (patch) | |
tree | e0079e33156249a8c97c881bfaab428189f984f6 | |
parent | f30c59e921f12b209852e1ddc197dc6a8fb0142b (diff) |
powerpc/mm: Switch to generic RCU get_user_pages_fast
This patch switch the ppc arch to use the generic RCU based
gup implementation.
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
-rw-r--r-- | arch/powerpc/Kconfig | 1 | ||||
-rw-r--r-- | arch/powerpc/include/asm/hugetlb.h | 8 | ||||
-rw-r--r-- | arch/powerpc/include/asm/page.h | 3 | ||||
-rw-r--r-- | arch/powerpc/include/asm/pgtable-ppc64.h | 1 | ||||
-rw-r--r-- | arch/powerpc/include/asm/pgtable.h | 6 | ||||
-rw-r--r-- | arch/powerpc/mm/Makefile | 2 | ||||
-rw-r--r-- | arch/powerpc/mm/gup.c | 235 | ||||
-rw-r--r-- | arch/powerpc/mm/hugetlbpage.c | 33 |
8 files changed, 22 insertions, 267 deletions
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig index 98e9c548bd75..46227336aacb 100644 --- a/arch/powerpc/Kconfig +++ b/arch/powerpc/Kconfig | |||
@@ -149,6 +149,7 @@ config PPC | |||
149 | select ARCH_SUPPORTS_ATOMIC_RMW | 149 | select ARCH_SUPPORTS_ATOMIC_RMW |
150 | select DCACHE_WORD_ACCESS if PPC64 && CPU_LITTLE_ENDIAN | 150 | select DCACHE_WORD_ACCESS if PPC64 && CPU_LITTLE_ENDIAN |
151 | select NO_BOOTMEM | 151 | select NO_BOOTMEM |
152 | select HAVE_GENERIC_RCU_GUP | ||
152 | 153 | ||
153 | config GENERIC_CSUM | 154 | config GENERIC_CSUM |
154 | def_bool CPU_LITTLE_ENDIAN | 155 | def_bool CPU_LITTLE_ENDIAN |
diff --git a/arch/powerpc/include/asm/hugetlb.h b/arch/powerpc/include/asm/hugetlb.h index 766b77d527ac..1d53a65b4ec1 100644 --- a/arch/powerpc/include/asm/hugetlb.h +++ b/arch/powerpc/include/asm/hugetlb.h | |||
@@ -48,7 +48,7 @@ static inline unsigned int hugepd_shift(hugepd_t hpd) | |||
48 | #endif /* CONFIG_PPC_BOOK3S_64 */ | 48 | #endif /* CONFIG_PPC_BOOK3S_64 */ |
49 | 49 | ||
50 | 50 | ||
51 | static inline pte_t *hugepte_offset(hugepd_t *hpdp, unsigned long addr, | 51 | static inline pte_t *hugepte_offset(hugepd_t hpd, unsigned long addr, |
52 | unsigned pdshift) | 52 | unsigned pdshift) |
53 | { | 53 | { |
54 | /* | 54 | /* |
@@ -58,9 +58,9 @@ static inline pte_t *hugepte_offset(hugepd_t *hpdp, unsigned long addr, | |||
58 | */ | 58 | */ |
59 | unsigned long idx = 0; | 59 | unsigned long idx = 0; |
60 | 60 | ||
61 | pte_t *dir = hugepd_page(*hpdp); | 61 | pte_t *dir = hugepd_page(hpd); |
62 | #ifndef CONFIG_PPC_FSL_BOOK3E | 62 | #ifndef CONFIG_PPC_FSL_BOOK3E |
63 | idx = (addr & ((1UL << pdshift) - 1)) >> hugepd_shift(*hpdp); | 63 | idx = (addr & ((1UL << pdshift) - 1)) >> hugepd_shift(hpd); |
64 | #endif | 64 | #endif |
65 | 65 | ||
66 | return dir + idx; | 66 | return dir + idx; |
@@ -193,7 +193,7 @@ static inline void flush_hugetlb_page(struct vm_area_struct *vma, | |||
193 | } | 193 | } |
194 | 194 | ||
195 | #define hugepd_shift(x) 0 | 195 | #define hugepd_shift(x) 0 |
196 | static inline pte_t *hugepte_offset(hugepd_t *hpdp, unsigned long addr, | 196 | static inline pte_t *hugepte_offset(hugepd_t hpd, unsigned long addr, |
197 | unsigned pdshift) | 197 | unsigned pdshift) |
198 | { | 198 | { |
199 | return 0; | 199 | return 0; |
diff --git a/arch/powerpc/include/asm/page.h b/arch/powerpc/include/asm/page.h index f973fce73a43..69c059887a2c 100644 --- a/arch/powerpc/include/asm/page.h +++ b/arch/powerpc/include/asm/page.h | |||
@@ -379,13 +379,14 @@ static inline int hugepd_ok(hugepd_t hpd) | |||
379 | } | 379 | } |
380 | #endif | 380 | #endif |
381 | 381 | ||
382 | #define is_hugepd(pdep) (hugepd_ok(*((hugepd_t *)(pdep)))) | 382 | #define is_hugepd(hpd) (hugepd_ok(hpd)) |
383 | #define pgd_huge pgd_huge | 383 | #define pgd_huge pgd_huge |
384 | int pgd_huge(pgd_t pgd); | 384 | int pgd_huge(pgd_t pgd); |
385 | #else /* CONFIG_HUGETLB_PAGE */ | 385 | #else /* CONFIG_HUGETLB_PAGE */ |
386 | #define is_hugepd(pdep) 0 | 386 | #define is_hugepd(pdep) 0 |
387 | #define pgd_huge(pgd) 0 | 387 | #define pgd_huge(pgd) 0 |
388 | #endif /* CONFIG_HUGETLB_PAGE */ | 388 | #endif /* CONFIG_HUGETLB_PAGE */ |
389 | #define __hugepd(x) ((hugepd_t) { (x) }) | ||
389 | 390 | ||
390 | struct page; | 391 | struct page; |
391 | extern void clear_user_page(void *page, unsigned long vaddr, struct page *pg); | 392 | extern void clear_user_page(void *page, unsigned long vaddr, struct page *pg); |
diff --git a/arch/powerpc/include/asm/pgtable-ppc64.h b/arch/powerpc/include/asm/pgtable-ppc64.h index d12092420560..5600e434332f 100644 --- a/arch/powerpc/include/asm/pgtable-ppc64.h +++ b/arch/powerpc/include/asm/pgtable-ppc64.h | |||
@@ -600,6 +600,5 @@ static inline int pmd_move_must_withdraw(struct spinlock *new_pmd_ptl, | |||
600 | */ | 600 | */ |
601 | return true; | 601 | return true; |
602 | } | 602 | } |
603 | |||
604 | #endif /* __ASSEMBLY__ */ | 603 | #endif /* __ASSEMBLY__ */ |
605 | #endif /* _ASM_POWERPC_PGTABLE_PPC64_H_ */ | 604 | #endif /* _ASM_POWERPC_PGTABLE_PPC64_H_ */ |
diff --git a/arch/powerpc/include/asm/pgtable.h b/arch/powerpc/include/asm/pgtable.h index 316f9a5da173..a8805fee0df9 100644 --- a/arch/powerpc/include/asm/pgtable.h +++ b/arch/powerpc/include/asm/pgtable.h | |||
@@ -274,11 +274,9 @@ extern void paging_init(void); | |||
274 | */ | 274 | */ |
275 | extern void update_mmu_cache(struct vm_area_struct *, unsigned long, pte_t *); | 275 | extern void update_mmu_cache(struct vm_area_struct *, unsigned long, pte_t *); |
276 | 276 | ||
277 | extern int gup_hugepd(hugepd_t *hugepd, unsigned pdshift, unsigned long addr, | ||
278 | unsigned long end, int write, struct page **pages, int *nr); | ||
279 | |||
280 | extern int gup_hugepte(pte_t *ptep, unsigned long sz, unsigned long addr, | 277 | extern int gup_hugepte(pte_t *ptep, unsigned long sz, unsigned long addr, |
281 | unsigned long end, int write, struct page **pages, int *nr); | 278 | unsigned long end, int write, |
279 | struct page **pages, int *nr); | ||
282 | #ifndef CONFIG_TRANSPARENT_HUGEPAGE | 280 | #ifndef CONFIG_TRANSPARENT_HUGEPAGE |
283 | #define pmd_large(pmd) 0 | 281 | #define pmd_large(pmd) 0 |
284 | #define has_transparent_hugepage() 0 | 282 | #define has_transparent_hugepage() 0 |
diff --git a/arch/powerpc/mm/Makefile b/arch/powerpc/mm/Makefile index 325e861616a1..438dcd3fd0d1 100644 --- a/arch/powerpc/mm/Makefile +++ b/arch/powerpc/mm/Makefile | |||
@@ -6,7 +6,7 @@ subdir-ccflags-$(CONFIG_PPC_WERROR) := -Werror | |||
6 | 6 | ||
7 | ccflags-$(CONFIG_PPC64) := $(NO_MINIMAL_TOC) | 7 | ccflags-$(CONFIG_PPC64) := $(NO_MINIMAL_TOC) |
8 | 8 | ||
9 | obj-y := fault.o mem.o pgtable.o gup.o mmap.o \ | 9 | obj-y := fault.o mem.o pgtable.o mmap.o \ |
10 | init_$(CONFIG_WORD_SIZE).o \ | 10 | init_$(CONFIG_WORD_SIZE).o \ |
11 | pgtable_$(CONFIG_WORD_SIZE).o | 11 | pgtable_$(CONFIG_WORD_SIZE).o |
12 | obj-$(CONFIG_PPC_MMU_NOHASH) += mmu_context_nohash.o tlb_nohash.o \ | 12 | obj-$(CONFIG_PPC_MMU_NOHASH) += mmu_context_nohash.o tlb_nohash.o \ |
diff --git a/arch/powerpc/mm/gup.c b/arch/powerpc/mm/gup.c deleted file mode 100644 index d8746684f606..000000000000 --- a/arch/powerpc/mm/gup.c +++ /dev/null | |||
@@ -1,235 +0,0 @@ | |||
1 | /* | ||
2 | * Lockless get_user_pages_fast for powerpc | ||
3 | * | ||
4 | * Copyright (C) 2008 Nick Piggin | ||
5 | * Copyright (C) 2008 Novell Inc. | ||
6 | */ | ||
7 | #undef DEBUG | ||
8 | |||
9 | #include <linux/sched.h> | ||
10 | #include <linux/mm.h> | ||
11 | #include <linux/hugetlb.h> | ||
12 | #include <linux/vmstat.h> | ||
13 | #include <linux/pagemap.h> | ||
14 | #include <linux/rwsem.h> | ||
15 | #include <asm/pgtable.h> | ||
16 | |||
17 | #ifdef __HAVE_ARCH_PTE_SPECIAL | ||
18 | |||
19 | /* | ||
20 | * The performance critical leaf functions are made noinline otherwise gcc | ||
21 | * inlines everything into a single function which results in too much | ||
22 | * register pressure. | ||
23 | */ | ||
24 | static noinline int gup_pte_range(pmd_t pmd, unsigned long addr, | ||
25 | unsigned long end, int write, struct page **pages, int *nr) | ||
26 | { | ||
27 | unsigned long mask, result; | ||
28 | pte_t *ptep; | ||
29 | |||
30 | result = _PAGE_PRESENT|_PAGE_USER; | ||
31 | if (write) | ||
32 | result |= _PAGE_RW; | ||
33 | mask = result | _PAGE_SPECIAL; | ||
34 | |||
35 | ptep = pte_offset_kernel(&pmd, addr); | ||
36 | do { | ||
37 | pte_t pte = ACCESS_ONCE(*ptep); | ||
38 | struct page *page; | ||
39 | /* | ||
40 | * Similar to the PMD case, NUMA hinting must take slow path | ||
41 | */ | ||
42 | if (pte_numa(pte)) | ||
43 | return 0; | ||
44 | |||
45 | if ((pte_val(pte) & mask) != result) | ||
46 | return 0; | ||
47 | VM_BUG_ON(!pfn_valid(pte_pfn(pte))); | ||
48 | page = pte_page(pte); | ||
49 | if (!page_cache_get_speculative(page)) | ||
50 | return 0; | ||
51 | if (unlikely(pte_val(pte) != pte_val(*ptep))) { | ||
52 | put_page(page); | ||
53 | return 0; | ||
54 | } | ||
55 | pages[*nr] = page; | ||
56 | (*nr)++; | ||
57 | |||
58 | } while (ptep++, addr += PAGE_SIZE, addr != end); | ||
59 | |||
60 | return 1; | ||
61 | } | ||
62 | |||
63 | static int gup_pmd_range(pud_t pud, unsigned long addr, unsigned long end, | ||
64 | int write, struct page **pages, int *nr) | ||
65 | { | ||
66 | unsigned long next; | ||
67 | pmd_t *pmdp; | ||
68 | |||
69 | pmdp = pmd_offset(&pud, addr); | ||
70 | do { | ||
71 | pmd_t pmd = ACCESS_ONCE(*pmdp); | ||
72 | |||
73 | next = pmd_addr_end(addr, end); | ||
74 | /* | ||
75 | * If we find a splitting transparent hugepage we | ||
76 | * return zero. That will result in taking the slow | ||
77 | * path which will call wait_split_huge_page() | ||
78 | * if the pmd is still in splitting state | ||
79 | */ | ||
80 | if (pmd_none(pmd) || pmd_trans_splitting(pmd)) | ||
81 | return 0; | ||
82 | if (pmd_huge(pmd) || pmd_large(pmd)) { | ||
83 | /* | ||
84 | * NUMA hinting faults need to be handled in the GUP | ||
85 | * slowpath for accounting purposes and so that they | ||
86 | * can be serialised against THP migration. | ||
87 | */ | ||
88 | if (pmd_numa(pmd)) | ||
89 | return 0; | ||
90 | |||
91 | if (!gup_hugepte((pte_t *)pmdp, PMD_SIZE, addr, next, | ||
92 | write, pages, nr)) | ||
93 | return 0; | ||
94 | } else if (is_hugepd(pmdp)) { | ||
95 | if (!gup_hugepd((hugepd_t *)pmdp, PMD_SHIFT, | ||
96 | addr, next, write, pages, nr)) | ||
97 | return 0; | ||
98 | } else if (!gup_pte_range(pmd, addr, next, write, pages, nr)) | ||
99 | return 0; | ||
100 | } while (pmdp++, addr = next, addr != end); | ||
101 | |||
102 | return 1; | ||
103 | } | ||
104 | |||
105 | static int gup_pud_range(pgd_t pgd, unsigned long addr, unsigned long end, | ||
106 | int write, struct page **pages, int *nr) | ||
107 | { | ||
108 | unsigned long next; | ||
109 | pud_t *pudp; | ||
110 | |||
111 | pudp = pud_offset(&pgd, addr); | ||
112 | do { | ||
113 | pud_t pud = ACCESS_ONCE(*pudp); | ||
114 | |||
115 | next = pud_addr_end(addr, end); | ||
116 | if (pud_none(pud)) | ||
117 | return 0; | ||
118 | if (pud_huge(pud)) { | ||
119 | if (!gup_hugepte((pte_t *)pudp, PUD_SIZE, addr, next, | ||
120 | write, pages, nr)) | ||
121 | return 0; | ||
122 | } else if (is_hugepd(pudp)) { | ||
123 | if (!gup_hugepd((hugepd_t *)pudp, PUD_SHIFT, | ||
124 | addr, next, write, pages, nr)) | ||
125 | return 0; | ||
126 | } else if (!gup_pmd_range(pud, addr, next, write, pages, nr)) | ||
127 | return 0; | ||
128 | } while (pudp++, addr = next, addr != end); | ||
129 | |||
130 | return 1; | ||
131 | } | ||
132 | |||
133 | int __get_user_pages_fast(unsigned long start, int nr_pages, int write, | ||
134 | struct page **pages) | ||
135 | { | ||
136 | struct mm_struct *mm = current->mm; | ||
137 | unsigned long addr, len, end; | ||
138 | unsigned long next; | ||
139 | unsigned long flags; | ||
140 | pgd_t *pgdp; | ||
141 | int nr = 0; | ||
142 | |||
143 | pr_devel("%s(%lx,%x,%s)\n", __func__, start, nr_pages, write ? "write" : "read"); | ||
144 | |||
145 | start &= PAGE_MASK; | ||
146 | addr = start; | ||
147 | len = (unsigned long) nr_pages << PAGE_SHIFT; | ||
148 | end = start + len; | ||
149 | |||
150 | if (unlikely(!access_ok(write ? VERIFY_WRITE : VERIFY_READ, | ||
151 | start, len))) | ||
152 | return 0; | ||
153 | |||
154 | pr_devel(" aligned: %lx .. %lx\n", start, end); | ||
155 | |||
156 | /* | ||
157 | * XXX: batch / limit 'nr', to avoid large irq off latency | ||
158 | * needs some instrumenting to determine the common sizes used by | ||
159 | * important workloads (eg. DB2), and whether limiting the batch size | ||
160 | * will decrease performance. | ||
161 | * | ||
162 | * It seems like we're in the clear for the moment. Direct-IO is | ||
163 | * the main guy that batches up lots of get_user_pages, and even | ||
164 | * they are limited to 64-at-a-time which is not so many. | ||
165 | */ | ||
166 | /* | ||
167 | * This doesn't prevent pagetable teardown, but does prevent | ||
168 | * the pagetables from being freed on powerpc. | ||
169 | * | ||
170 | * So long as we atomically load page table pointers versus teardown, | ||
171 | * we can follow the address down to the the page and take a ref on it. | ||
172 | */ | ||
173 | local_irq_save(flags); | ||
174 | |||
175 | pgdp = pgd_offset(mm, addr); | ||
176 | do { | ||
177 | pgd_t pgd = ACCESS_ONCE(*pgdp); | ||
178 | |||
179 | pr_devel(" %016lx: normal pgd %p\n", addr, | ||
180 | (void *)pgd_val(pgd)); | ||
181 | next = pgd_addr_end(addr, end); | ||
182 | if (pgd_none(pgd)) | ||
183 | break; | ||
184 | if (pgd_huge(pgd)) { | ||
185 | if (!gup_hugepte((pte_t *)pgdp, PGDIR_SIZE, addr, next, | ||
186 | write, pages, &nr)) | ||
187 | break; | ||
188 | } else if (is_hugepd(pgdp)) { | ||
189 | if (!gup_hugepd((hugepd_t *)pgdp, PGDIR_SHIFT, | ||
190 | addr, next, write, pages, &nr)) | ||
191 | break; | ||
192 | } else if (!gup_pud_range(pgd, addr, next, write, pages, &nr)) | ||
193 | break; | ||
194 | } while (pgdp++, addr = next, addr != end); | ||
195 | |||
196 | local_irq_restore(flags); | ||
197 | |||
198 | return nr; | ||
199 | } | ||
200 | |||
201 | int get_user_pages_fast(unsigned long start, int nr_pages, int write, | ||
202 | struct page **pages) | ||
203 | { | ||
204 | struct mm_struct *mm = current->mm; | ||
205 | int nr, ret; | ||
206 | |||
207 | start &= PAGE_MASK; | ||
208 | nr = __get_user_pages_fast(start, nr_pages, write, pages); | ||
209 | ret = nr; | ||
210 | |||
211 | if (nr < nr_pages) { | ||
212 | pr_devel(" slow path ! nr = %d\n", nr); | ||
213 | |||
214 | /* Try to get the remaining pages with get_user_pages */ | ||
215 | start += nr << PAGE_SHIFT; | ||
216 | pages += nr; | ||
217 | |||
218 | down_read(&mm->mmap_sem); | ||
219 | ret = get_user_pages(current, mm, start, | ||
220 | nr_pages - nr, write, 0, pages, NULL); | ||
221 | up_read(&mm->mmap_sem); | ||
222 | |||
223 | /* Have to be a bit careful with return values */ | ||
224 | if (nr > 0) { | ||
225 | if (ret < 0) | ||
226 | ret = nr; | ||
227 | else | ||
228 | ret += nr; | ||
229 | } | ||
230 | } | ||
231 | |||
232 | return ret; | ||
233 | } | ||
234 | |||
235 | #endif /* __HAVE_ARCH_PTE_SPECIAL */ | ||
diff --git a/arch/powerpc/mm/hugetlbpage.c b/arch/powerpc/mm/hugetlbpage.c index 2b8e5ed28831..af56de82375d 100644 --- a/arch/powerpc/mm/hugetlbpage.c +++ b/arch/powerpc/mm/hugetlbpage.c | |||
@@ -233,7 +233,7 @@ pte_t *huge_pte_alloc(struct mm_struct *mm, unsigned long addr, unsigned long sz | |||
233 | if (hugepd_none(*hpdp) && __hugepte_alloc(mm, hpdp, addr, pdshift, pshift)) | 233 | if (hugepd_none(*hpdp) && __hugepte_alloc(mm, hpdp, addr, pdshift, pshift)) |
234 | return NULL; | 234 | return NULL; |
235 | 235 | ||
236 | return hugepte_offset(hpdp, addr, pdshift); | 236 | return hugepte_offset(*hpdp, addr, pdshift); |
237 | } | 237 | } |
238 | 238 | ||
239 | #else | 239 | #else |
@@ -273,7 +273,7 @@ pte_t *huge_pte_alloc(struct mm_struct *mm, unsigned long addr, unsigned long sz | |||
273 | if (hugepd_none(*hpdp) && __hugepte_alloc(mm, hpdp, addr, pdshift, pshift)) | 273 | if (hugepd_none(*hpdp) && __hugepte_alloc(mm, hpdp, addr, pdshift, pshift)) |
274 | return NULL; | 274 | return NULL; |
275 | 275 | ||
276 | return hugepte_offset(hpdp, addr, pdshift); | 276 | return hugepte_offset(*hpdp, addr, pdshift); |
277 | } | 277 | } |
278 | #endif | 278 | #endif |
279 | 279 | ||
@@ -541,7 +541,7 @@ static void hugetlb_free_pmd_range(struct mmu_gather *tlb, pud_t *pud, | |||
541 | do { | 541 | do { |
542 | pmd = pmd_offset(pud, addr); | 542 | pmd = pmd_offset(pud, addr); |
543 | next = pmd_addr_end(addr, end); | 543 | next = pmd_addr_end(addr, end); |
544 | if (!is_hugepd(pmd)) { | 544 | if (!is_hugepd(__hugepd(pmd_val(*pmd)))) { |
545 | /* | 545 | /* |
546 | * if it is not hugepd pointer, we should already find | 546 | * if it is not hugepd pointer, we should already find |
547 | * it cleared. | 547 | * it cleared. |
@@ -590,7 +590,7 @@ static void hugetlb_free_pud_range(struct mmu_gather *tlb, pgd_t *pgd, | |||
590 | do { | 590 | do { |
591 | pud = pud_offset(pgd, addr); | 591 | pud = pud_offset(pgd, addr); |
592 | next = pud_addr_end(addr, end); | 592 | next = pud_addr_end(addr, end); |
593 | if (!is_hugepd(pud)) { | 593 | if (!is_hugepd(__hugepd(pud_val(*pud)))) { |
594 | if (pud_none_or_clear_bad(pud)) | 594 | if (pud_none_or_clear_bad(pud)) |
595 | continue; | 595 | continue; |
596 | hugetlb_free_pmd_range(tlb, pud, addr, next, floor, | 596 | hugetlb_free_pmd_range(tlb, pud, addr, next, floor, |
@@ -656,7 +656,7 @@ void hugetlb_free_pgd_range(struct mmu_gather *tlb, | |||
656 | do { | 656 | do { |
657 | next = pgd_addr_end(addr, end); | 657 | next = pgd_addr_end(addr, end); |
658 | pgd = pgd_offset(tlb->mm, addr); | 658 | pgd = pgd_offset(tlb->mm, addr); |
659 | if (!is_hugepd(pgd)) { | 659 | if (!is_hugepd(__hugepd(pgd_val(*pgd)))) { |
660 | if (pgd_none_or_clear_bad(pgd)) | 660 | if (pgd_none_or_clear_bad(pgd)) |
661 | continue; | 661 | continue; |
662 | hugetlb_free_pud_range(tlb, pgd, addr, next, floor, ceiling); | 662 | hugetlb_free_pud_range(tlb, pgd, addr, next, floor, ceiling); |
@@ -716,12 +716,11 @@ static unsigned long hugepte_addr_end(unsigned long addr, unsigned long end, | |||
716 | return (__boundary - 1 < end - 1) ? __boundary : end; | 716 | return (__boundary - 1 < end - 1) ? __boundary : end; |
717 | } | 717 | } |
718 | 718 | ||
719 | int gup_hugepd(hugepd_t *hugepd, unsigned pdshift, | 719 | int gup_huge_pd(hugepd_t hugepd, unsigned long addr, unsigned pdshift, |
720 | unsigned long addr, unsigned long end, | 720 | unsigned long end, int write, struct page **pages, int *nr) |
721 | int write, struct page **pages, int *nr) | ||
722 | { | 721 | { |
723 | pte_t *ptep; | 722 | pte_t *ptep; |
724 | unsigned long sz = 1UL << hugepd_shift(*hugepd); | 723 | unsigned long sz = 1UL << hugepd_shift(hugepd); |
725 | unsigned long next; | 724 | unsigned long next; |
726 | 725 | ||
727 | ptep = hugepte_offset(hugepd, addr, pdshift); | 726 | ptep = hugepte_offset(hugepd, addr, pdshift); |
@@ -964,7 +963,7 @@ pte_t *find_linux_pte_or_hugepte(pgd_t *pgdir, unsigned long ea, unsigned *shift | |||
964 | else if (pgd_huge(pgd)) { | 963 | else if (pgd_huge(pgd)) { |
965 | ret_pte = (pte_t *) pgdp; | 964 | ret_pte = (pte_t *) pgdp; |
966 | goto out; | 965 | goto out; |
967 | } else if (is_hugepd(&pgd)) | 966 | } else if (is_hugepd(__hugepd(pgd_val(pgd)))) |
968 | hpdp = (hugepd_t *)&pgd; | 967 | hpdp = (hugepd_t *)&pgd; |
969 | else { | 968 | else { |
970 | /* | 969 | /* |
@@ -981,7 +980,7 @@ pte_t *find_linux_pte_or_hugepte(pgd_t *pgdir, unsigned long ea, unsigned *shift | |||
981 | else if (pud_huge(pud)) { | 980 | else if (pud_huge(pud)) { |
982 | ret_pte = (pte_t *) pudp; | 981 | ret_pte = (pte_t *) pudp; |
983 | goto out; | 982 | goto out; |
984 | } else if (is_hugepd(&pud)) | 983 | } else if (is_hugepd(__hugepd(pud_val(pud)))) |
985 | hpdp = (hugepd_t *)&pud; | 984 | hpdp = (hugepd_t *)&pud; |
986 | else { | 985 | else { |
987 | pdshift = PMD_SHIFT; | 986 | pdshift = PMD_SHIFT; |
@@ -1002,7 +1001,7 @@ pte_t *find_linux_pte_or_hugepte(pgd_t *pgdir, unsigned long ea, unsigned *shift | |||
1002 | if (pmd_huge(pmd) || pmd_large(pmd)) { | 1001 | if (pmd_huge(pmd) || pmd_large(pmd)) { |
1003 | ret_pte = (pte_t *) pmdp; | 1002 | ret_pte = (pte_t *) pmdp; |
1004 | goto out; | 1003 | goto out; |
1005 | } else if (is_hugepd(&pmd)) | 1004 | } else if (is_hugepd(__hugepd(pmd_val(pmd)))) |
1006 | hpdp = (hugepd_t *)&pmd; | 1005 | hpdp = (hugepd_t *)&pmd; |
1007 | else | 1006 | else |
1008 | return pte_offset_kernel(&pmd, ea); | 1007 | return pte_offset_kernel(&pmd, ea); |
@@ -1011,7 +1010,7 @@ pte_t *find_linux_pte_or_hugepte(pgd_t *pgdir, unsigned long ea, unsigned *shift | |||
1011 | if (!hpdp) | 1010 | if (!hpdp) |
1012 | return NULL; | 1011 | return NULL; |
1013 | 1012 | ||
1014 | ret_pte = hugepte_offset(hpdp, ea, pdshift); | 1013 | ret_pte = hugepte_offset(*hpdp, ea, pdshift); |
1015 | pdshift = hugepd_shift(*hpdp); | 1014 | pdshift = hugepd_shift(*hpdp); |
1016 | out: | 1015 | out: |
1017 | if (shift) | 1016 | if (shift) |
@@ -1041,14 +1040,6 @@ int gup_hugepte(pte_t *ptep, unsigned long sz, unsigned long addr, | |||
1041 | if ((pte_val(pte) & mask) != mask) | 1040 | if ((pte_val(pte) & mask) != mask) |
1042 | return 0; | 1041 | return 0; |
1043 | 1042 | ||
1044 | #ifdef CONFIG_TRANSPARENT_HUGEPAGE | ||
1045 | /* | ||
1046 | * check for splitting here | ||
1047 | */ | ||
1048 | if (pmd_trans_splitting(pte_pmd(pte))) | ||
1049 | return 0; | ||
1050 | #endif | ||
1051 | |||
1052 | /* hugepages are never "special" */ | 1043 | /* hugepages are never "special" */ |
1053 | VM_BUG_ON(!pfn_valid(pte_pfn(pte))); | 1044 | VM_BUG_ON(!pfn_valid(pte_pfn(pte))); |
1054 | 1045 | ||