blob: 16799f920f90e0a1a01ca095526d49558066647b [file] [log] [blame]
Paul Mundt26ff6c12006-09-27 15:13:36 +09001/*
2 * Page fault handler for SH with an MMU.
Linus Torvalds1da177e2005-04-16 15:20:36 -07003 *
Linus Torvalds1da177e2005-04-16 15:20:36 -07004 * Copyright (C) 1999 Niibe Yutaka
Paul Mundtdbdb4e92012-05-14 10:27:34 +09005 * Copyright (C) 2003 - 2012 Paul Mundt
Linus Torvalds1da177e2005-04-16 15:20:36 -07006 *
7 * Based on linux/arch/i386/mm/fault.c:
8 * Copyright (C) 1995 Linus Torvalds
Paul Mundt26ff6c12006-09-27 15:13:36 +09009 *
10 * This file is subject to the terms and conditions of the GNU General Public
11 * License. See the file "COPYING" in the main directory of this archive
12 * for more details.
Linus Torvalds1da177e2005-04-16 15:20:36 -070013 */
Linus Torvalds1da177e2005-04-16 15:20:36 -070014#include <linux/kernel.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070015#include <linux/mm.h>
Paul Mundt0f08f332006-09-27 17:03:56 +090016#include <linux/hardirq.h>
17#include <linux/kprobes.h>
Ingo Molnarcdd6c482009-09-21 12:02:48 +020018#include <linux/perf_event.h>
Paul Mundtdbdb4e92012-05-14 10:27:34 +090019#include <linux/kdebug.h>
Magnus Damme7cc9a72008-02-07 20:18:21 +090020#include <asm/io_trapped.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070021#include <asm/mmu_context.h>
Paul Mundtdb2e1fa2007-02-14 14:13:10 +090022#include <asm/tlbflush.h>
David Howellse839ca52012-03-28 18:30:03 +010023#include <asm/traps.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070024
Paul Mundt7433ab7702009-06-25 02:30:10 +090025static inline int notify_page_fault(struct pt_regs *regs, int trap)
26{
27 int ret = 0;
28
Paul Mundtc63c3102009-07-05 02:50:10 +090029 if (kprobes_built_in() && !user_mode(regs)) {
Paul Mundt7433ab7702009-06-25 02:30:10 +090030 preempt_disable();
31 if (kprobe_running() && kprobe_fault_handler(regs, trap))
32 ret = 1;
33 preempt_enable();
34 }
Paul Mundt7433ab7702009-06-25 02:30:10 +090035
36 return ret;
37}
38
Paul Mundtdbdb4e92012-05-14 10:27:34 +090039static void
40force_sig_info_fault(int si_signo, int si_code, unsigned long address,
41 struct task_struct *tsk)
42{
43 siginfo_t info;
44
45 info.si_signo = si_signo;
46 info.si_errno = 0;
47 info.si_code = si_code;
48 info.si_addr = (void __user *)address;
49
50 force_sig_info(si_signo, &info, tsk);
51}
52
Stuart Menefy45c0e0e2012-04-19 17:25:03 +090053/*
54 * This is useful to dump out the page tables associated with
55 * 'addr' in mm 'mm'.
56 */
57static void show_pte(struct mm_struct *mm, unsigned long addr)
58{
59 pgd_t *pgd;
60
61 if (mm)
62 pgd = mm->pgd;
63 else
64 pgd = get_TTB();
65
66 printk(KERN_ALERT "pgd = %p\n", pgd);
67 pgd += pgd_index(addr);
68 printk(KERN_ALERT "[%08lx] *pgd=%0*Lx", addr,
Paul Mundt28080322012-05-14 15:33:28 +090069 (u32)(sizeof(*pgd) * 2), (u64)pgd_val(*pgd));
Stuart Menefy45c0e0e2012-04-19 17:25:03 +090070
71 do {
72 pud_t *pud;
73 pmd_t *pmd;
74 pte_t *pte;
75
76 if (pgd_none(*pgd))
77 break;
78
79 if (pgd_bad(*pgd)) {
80 printk("(bad)");
81 break;
82 }
83
84 pud = pud_offset(pgd, addr);
85 if (PTRS_PER_PUD != 1)
Paul Mundt28080322012-05-14 15:33:28 +090086 printk(", *pud=%0*Lx", (u32)(sizeof(*pud) * 2),
Stuart Menefy45c0e0e2012-04-19 17:25:03 +090087 (u64)pud_val(*pud));
88
89 if (pud_none(*pud))
90 break;
91
92 if (pud_bad(*pud)) {
93 printk("(bad)");
94 break;
95 }
96
97 pmd = pmd_offset(pud, addr);
98 if (PTRS_PER_PMD != 1)
Paul Mundt28080322012-05-14 15:33:28 +090099 printk(", *pmd=%0*Lx", (u32)(sizeof(*pmd) * 2),
Stuart Menefy45c0e0e2012-04-19 17:25:03 +0900100 (u64)pmd_val(*pmd));
101
102 if (pmd_none(*pmd))
103 break;
104
105 if (pmd_bad(*pmd)) {
106 printk("(bad)");
107 break;
108 }
109
110 /* We must not map this if we have highmem enabled */
111 if (PageHighMem(pfn_to_page(pmd_val(*pmd) >> PAGE_SHIFT)))
112 break;
113
114 pte = pte_offset_kernel(pmd, addr);
Paul Mundt28080322012-05-14 15:33:28 +0900115 printk(", *pte=%0*Lx", (u32)(sizeof(*pte) * 2),
116 (u64)pte_val(*pte));
Stuart Menefy45c0e0e2012-04-19 17:25:03 +0900117 } while (0);
118
119 printk("\n");
120}
121
Paul Mundt0f60bb22009-07-05 03:18:47 +0900122static inline pmd_t *vmalloc_sync_one(pgd_t *pgd, unsigned long address)
123{
124 unsigned index = pgd_index(address);
125 pgd_t *pgd_k;
126 pud_t *pud, *pud_k;
127 pmd_t *pmd, *pmd_k;
128
129 pgd += index;
130 pgd_k = init_mm.pgd + index;
131
132 if (!pgd_present(*pgd_k))
133 return NULL;
134
135 pud = pud_offset(pgd, address);
136 pud_k = pud_offset(pgd_k, address);
137 if (!pud_present(*pud_k))
138 return NULL;
139
Matt Fleming5d9b4b12009-12-13 14:38:50 +0000140 if (!pud_present(*pud))
141 set_pud(pud, *pud_k);
142
Paul Mundt0f60bb22009-07-05 03:18:47 +0900143 pmd = pmd_offset(pud, address);
144 pmd_k = pmd_offset(pud_k, address);
145 if (!pmd_present(*pmd_k))
146 return NULL;
147
148 if (!pmd_present(*pmd))
149 set_pmd(pmd, *pmd_k);
Matt Fleming05dd2cd2009-07-13 11:38:04 +0000150 else {
151 /*
152 * The page tables are fully synchronised so there must
153 * be another reason for the fault. Return NULL here to
154 * signal that we have not taken care of the fault.
155 */
Paul Mundt0f60bb22009-07-05 03:18:47 +0900156 BUG_ON(pmd_page(*pmd) != pmd_page(*pmd_k));
Matt Fleming05dd2cd2009-07-13 11:38:04 +0000157 return NULL;
158 }
Paul Mundt0f60bb22009-07-05 03:18:47 +0900159
160 return pmd_k;
161}
162
163/*
164 * Handle a fault on the vmalloc or module mapping area
165 */
166static noinline int vmalloc_fault(unsigned long address)
167{
168 pgd_t *pgd_k;
169 pmd_t *pmd_k;
170 pte_t *pte_k;
171
Paul Mundt20e7c292012-05-14 15:11:35 +0900172 /* Make sure we are in vmalloc/module area: */
173 if (!is_vmalloc_addr((void *)address))
Paul Mundt0f60bb22009-07-05 03:18:47 +0900174 return -1;
175
176 /*
177 * Synchronize this task's top level page-table
178 * with the 'reference' page table.
179 *
180 * Do _not_ use "current" here. We might be inside
181 * an interrupt in the middle of a task switch..
182 */
183 pgd_k = get_TTB();
Matt Fleming05dd2cd2009-07-13 11:38:04 +0000184 pmd_k = vmalloc_sync_one(pgd_k, address);
Paul Mundt0f60bb22009-07-05 03:18:47 +0900185 if (!pmd_k)
186 return -1;
187
188 pte_k = pte_offset_kernel(pmd_k, address);
189 if (!pte_present(*pte_k))
190 return -1;
191
192 return 0;
193}
194
Paul Mundtdbdb4e92012-05-14 10:27:34 +0900195static void
196show_fault_oops(struct pt_regs *regs, unsigned long address)
197{
198 if (!oops_may_print())
199 return;
200
201 printk(KERN_ALERT "BUG: unable to handle kernel ");
202 if (address < PAGE_SIZE)
203 printk(KERN_CONT "NULL pointer dereference");
204 else
205 printk(KERN_CONT "paging request");
206
207 printk(KERN_CONT " at %08lx\n", address);
208 printk(KERN_ALERT "PC:");
209 printk_address(regs->pc, 1);
210
211 show_pte(NULL, address);
212}
213
214static noinline void
Paul Mundt5a1dc782012-05-14 14:57:28 +0900215no_context(struct pt_regs *regs, unsigned long error_code,
Paul Mundtdbdb4e92012-05-14 10:27:34 +0900216 unsigned long address)
217{
218 /* Are we prepared to handle this kernel fault? */
219 if (fixup_exception(regs))
220 return;
221
222 if (handle_trapped_io(regs, address))
223 return;
224
225 /*
226 * Oops. The kernel tried to access some bad page. We'll have to
227 * terminate things with extreme prejudice.
228 */
229 bust_spinlocks(1);
230
231 show_fault_oops(regs, address);
232
Paul Mundt5a1dc782012-05-14 14:57:28 +0900233 die("Oops", regs, error_code);
Paul Mundtdbdb4e92012-05-14 10:27:34 +0900234 bust_spinlocks(0);
235 do_exit(SIGKILL);
236}
237
238static void
Paul Mundt5a1dc782012-05-14 14:57:28 +0900239__bad_area_nosemaphore(struct pt_regs *regs, unsigned long error_code,
Paul Mundtdbdb4e92012-05-14 10:27:34 +0900240 unsigned long address, int si_code)
241{
242 struct task_struct *tsk = current;
243
244 /* User mode accesses just cause a SIGSEGV */
245 if (user_mode(regs)) {
246 /*
247 * It's possible to have interrupts off here:
248 */
249 local_irq_enable();
250
251 force_sig_info_fault(SIGSEGV, si_code, address, tsk);
252
253 return;
254 }
255
Paul Mundt5a1dc782012-05-14 14:57:28 +0900256 no_context(regs, error_code, address);
Paul Mundtdbdb4e92012-05-14 10:27:34 +0900257}
258
259static noinline void
Paul Mundt5a1dc782012-05-14 14:57:28 +0900260bad_area_nosemaphore(struct pt_regs *regs, unsigned long error_code,
Paul Mundtdbdb4e92012-05-14 10:27:34 +0900261 unsigned long address)
262{
Paul Mundt5a1dc782012-05-14 14:57:28 +0900263 __bad_area_nosemaphore(regs, error_code, address, SEGV_MAPERR);
Paul Mundtdbdb4e92012-05-14 10:27:34 +0900264}
265
266static void
Paul Mundt5a1dc782012-05-14 14:57:28 +0900267__bad_area(struct pt_regs *regs, unsigned long error_code,
Paul Mundtdbdb4e92012-05-14 10:27:34 +0900268 unsigned long address, int si_code)
269{
270 struct mm_struct *mm = current->mm;
271
272 /*
273 * Something tried to access memory that isn't in our memory map..
274 * Fix it, but check if it's kernel or user first..
275 */
276 up_read(&mm->mmap_sem);
277
Paul Mundt5a1dc782012-05-14 14:57:28 +0900278 __bad_area_nosemaphore(regs, error_code, address, si_code);
Paul Mundtdbdb4e92012-05-14 10:27:34 +0900279}
280
281static noinline void
Paul Mundt5a1dc782012-05-14 14:57:28 +0900282bad_area(struct pt_regs *regs, unsigned long error_code, unsigned long address)
Paul Mundtdbdb4e92012-05-14 10:27:34 +0900283{
Paul Mundt5a1dc782012-05-14 14:57:28 +0900284 __bad_area(regs, error_code, address, SEGV_MAPERR);
Paul Mundtdbdb4e92012-05-14 10:27:34 +0900285}
286
287static noinline void
Paul Mundt5a1dc782012-05-14 14:57:28 +0900288bad_area_access_error(struct pt_regs *regs, unsigned long error_code,
Paul Mundtdbdb4e92012-05-14 10:27:34 +0900289 unsigned long address)
290{
Paul Mundt5a1dc782012-05-14 14:57:28 +0900291 __bad_area(regs, error_code, address, SEGV_ACCERR);
Paul Mundtdbdb4e92012-05-14 10:27:34 +0900292}
293
294static void out_of_memory(void)
295{
296 /*
297 * We ran out of memory, call the OOM killer, and return the userspace
298 * (which will retry the fault, or kill us if we got oom-killed):
299 */
300 up_read(&current->mm->mmap_sem);
301
302 pagefault_out_of_memory();
303}
304
305static void
Paul Mundt5a1dc782012-05-14 14:57:28 +0900306do_sigbus(struct pt_regs *regs, unsigned long error_code, unsigned long address)
Paul Mundtdbdb4e92012-05-14 10:27:34 +0900307{
308 struct task_struct *tsk = current;
309 struct mm_struct *mm = tsk->mm;
310
311 up_read(&mm->mmap_sem);
312
313 /* Kernel mode? Handle exceptions or die: */
314 if (!user_mode(regs))
Paul Mundt5a1dc782012-05-14 14:57:28 +0900315 no_context(regs, error_code, address);
Paul Mundtdbdb4e92012-05-14 10:27:34 +0900316
317 force_sig_info_fault(SIGBUS, BUS_ADRERR, address, tsk);
318}
319
320static noinline int
Paul Mundt5a1dc782012-05-14 14:57:28 +0900321mm_fault_error(struct pt_regs *regs, unsigned long error_code,
Paul Mundtdbdb4e92012-05-14 10:27:34 +0900322 unsigned long address, unsigned int fault)
323{
324 /*
325 * Pagefault was interrupted by SIGKILL. We have no reason to
326 * continue pagefault.
327 */
328 if (fatal_signal_pending(current)) {
329 if (!(fault & VM_FAULT_RETRY))
330 up_read(&current->mm->mmap_sem);
331 if (!user_mode(regs))
Paul Mundt5a1dc782012-05-14 14:57:28 +0900332 no_context(regs, error_code, address);
Paul Mundtdbdb4e92012-05-14 10:27:34 +0900333 return 1;
334 }
335
336 if (!(fault & VM_FAULT_ERROR))
337 return 0;
338
339 if (fault & VM_FAULT_OOM) {
340 /* Kernel mode? Handle exceptions or die: */
341 if (!user_mode(regs)) {
342 up_read(&current->mm->mmap_sem);
Paul Mundt5a1dc782012-05-14 14:57:28 +0900343 no_context(regs, error_code, address);
Paul Mundtdbdb4e92012-05-14 10:27:34 +0900344 return 1;
345 }
346
347 out_of_memory();
348 } else {
349 if (fault & VM_FAULT_SIGBUS)
Paul Mundt5a1dc782012-05-14 14:57:28 +0900350 do_sigbus(regs, error_code, address);
Paul Mundtdbdb4e92012-05-14 10:27:34 +0900351 else
352 BUG();
353 }
354
355 return 1;
356}
357
Paul Mundt28080322012-05-14 15:33:28 +0900358static inline int access_error(int error_code, struct vm_area_struct *vma)
Paul Mundtdbdb4e92012-05-14 10:27:34 +0900359{
Paul Mundt28080322012-05-14 15:33:28 +0900360 if (error_code & FAULT_CODE_WRITE) {
Paul Mundtdbdb4e92012-05-14 10:27:34 +0900361 /* write, present and write, not present: */
362 if (unlikely(!(vma->vm_flags & VM_WRITE)))
363 return 1;
364 return 0;
365 }
366
Paul Mundt28080322012-05-14 15:33:28 +0900367 /* ITLB miss on NX page */
368 if (unlikely((error_code & FAULT_CODE_ITLB) &&
369 !(vma->vm_flags & VM_EXEC)))
370 return 1;
371
Paul Mundtdbdb4e92012-05-14 10:27:34 +0900372 /* read, not present: */
373 if (unlikely(!(vma->vm_flags & (VM_READ | VM_EXEC | VM_WRITE))))
374 return 1;
375
376 return 0;
377}
378
Paul Mundt0f60bb22009-07-05 03:18:47 +0900379static int fault_in_kernel_space(unsigned long address)
380{
381 return address >= TASK_SIZE;
382}
383
Linus Torvalds1da177e2005-04-16 15:20:36 -0700384/*
385 * This routine handles page faults. It determines the address,
386 * and the problem, and then passes it off to one of the appropriate
387 * routines.
388 */
Stuart Menefyb5a1bcb2006-11-21 13:34:04 +0900389asmlinkage void __kprobes do_page_fault(struct pt_regs *regs,
Paul Mundt5a1dc782012-05-14 14:57:28 +0900390 unsigned long error_code,
Stuart Menefyb5a1bcb2006-11-21 13:34:04 +0900391 unsigned long address)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700392{
Paul Mundt0f60bb22009-07-05 03:18:47 +0900393 unsigned long vec;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700394 struct task_struct *tsk;
395 struct mm_struct *mm;
396 struct vm_area_struct * vma;
Nick Piggin83c54072007-07-19 01:47:05 -0700397 int fault;
Paul Mundt5a1dc782012-05-14 14:57:28 +0900398 int write = error_code & FAULT_CODE_WRITE;
Kautuk Consul11fd9822012-03-31 08:06:11 -0400399 unsigned int flags = (FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE |
Paul Mundt5a1dc782012-05-14 14:57:28 +0900400 (write ? FAULT_FLAG_WRITE : 0));
Linus Torvalds1da177e2005-04-16 15:20:36 -0700401
Linus Torvalds1da177e2005-04-16 15:20:36 -0700402 tsk = current;
Paul Mundt0f60bb22009-07-05 03:18:47 +0900403 mm = tsk->mm;
Paul Mundt0f60bb22009-07-05 03:18:47 +0900404 vec = lookup_exception_vector();
Linus Torvalds1da177e2005-04-16 15:20:36 -0700405
Paul Mundt0f60bb22009-07-05 03:18:47 +0900406 /*
407 * We fault-in kernel-space virtual memory on-demand. The
408 * 'reference' page table is init_mm.pgd.
409 *
410 * NOTE! We MUST NOT take any locks for this case. We may
411 * be in an interrupt or a critical region, and should
412 * only copy the information from the master page table,
413 * nothing more.
414 */
415 if (unlikely(fault_in_kernel_space(address))) {
416 if (vmalloc_fault(address) >= 0)
Stuart Menefy99a596f2006-11-21 15:38:05 +0900417 return;
Paul Mundt0f60bb22009-07-05 03:18:47 +0900418 if (notify_page_fault(regs, vec))
Stuart Menefy96e14e52008-09-05 16:17:15 +0900419 return;
Stuart Menefy99a596f2006-11-21 15:38:05 +0900420
Paul Mundt5a1dc782012-05-14 14:57:28 +0900421 bad_area_nosemaphore(regs, error_code, address);
Paul Mundtdbdb4e92012-05-14 10:27:34 +0900422 return;
Stuart Menefy99a596f2006-11-21 15:38:05 +0900423 }
424
Paul Mundt0f60bb22009-07-05 03:18:47 +0900425 if (unlikely(notify_page_fault(regs, vec)))
Paul Mundt7433ab7702009-06-25 02:30:10 +0900426 return;
427
428 /* Only enable interrupts if they were on before the fault */
429 if ((regs->sr & SR_IMASK) != SR_IMASK)
430 local_irq_enable();
431
Peter Zijlstraa8b0ca12011-06-27 14:41:57 +0200432 perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS, 1, regs, address);
Paul Mundt7433ab7702009-06-25 02:30:10 +0900433
Linus Torvalds1da177e2005-04-16 15:20:36 -0700434 /*
Paul Mundt0f60bb22009-07-05 03:18:47 +0900435 * If we're in an interrupt, have no user context or are running
436 * in an atomic region then we must not take the fault:
Linus Torvalds1da177e2005-04-16 15:20:36 -0700437 */
Paul Mundtdbdb4e92012-05-14 10:27:34 +0900438 if (unlikely(in_atomic() || !mm)) {
Paul Mundt5a1dc782012-05-14 14:57:28 +0900439 bad_area_nosemaphore(regs, error_code, address);
Paul Mundtdbdb4e92012-05-14 10:27:34 +0900440 return;
441 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700442
Kautuk Consul11fd9822012-03-31 08:06:11 -0400443retry:
Linus Torvalds1da177e2005-04-16 15:20:36 -0700444 down_read(&mm->mmap_sem);
445
446 vma = find_vma(mm, address);
Paul Mundtdbdb4e92012-05-14 10:27:34 +0900447 if (unlikely(!vma)) {
Paul Mundt5a1dc782012-05-14 14:57:28 +0900448 bad_area(regs, error_code, address);
Paul Mundtdbdb4e92012-05-14 10:27:34 +0900449 return;
450 }
451 if (likely(vma->vm_start <= address))
Linus Torvalds1da177e2005-04-16 15:20:36 -0700452 goto good_area;
Paul Mundtdbdb4e92012-05-14 10:27:34 +0900453 if (unlikely(!(vma->vm_flags & VM_GROWSDOWN))) {
Paul Mundt5a1dc782012-05-14 14:57:28 +0900454 bad_area(regs, error_code, address);
Paul Mundtdbdb4e92012-05-14 10:27:34 +0900455 return;
456 }
457 if (unlikely(expand_stack(vma, address))) {
Paul Mundt5a1dc782012-05-14 14:57:28 +0900458 bad_area(regs, error_code, address);
Paul Mundtdbdb4e92012-05-14 10:27:34 +0900459 return;
460 }
Paul Mundt0f60bb22009-07-05 03:18:47 +0900461
462 /*
463 * Ok, we have a good vm_area for this memory access, so
464 * we can handle it..
465 */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700466good_area:
Paul Mundt5a1dc782012-05-14 14:57:28 +0900467 if (unlikely(access_error(error_code, vma))) {
468 bad_area_access_error(regs, error_code, address);
Paul Mundtdbdb4e92012-05-14 10:27:34 +0900469 return;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700470 }
471
Paul Mundt5a1dc782012-05-14 14:57:28 +0900472 set_thread_fault_code(error_code);
473
Linus Torvalds1da177e2005-04-16 15:20:36 -0700474 /*
475 * If for any reason at all we couldn't handle the fault,
476 * make sure we exit gracefully rather than endlessly redo
477 * the fault.
478 */
Kautuk Consul11fd9822012-03-31 08:06:11 -0400479 fault = handle_mm_fault(mm, vma, address, flags);
480
Paul Mundtdbdb4e92012-05-14 10:27:34 +0900481 if (unlikely(fault & (VM_FAULT_RETRY | VM_FAULT_ERROR)))
Paul Mundt5a1dc782012-05-14 14:57:28 +0900482 if (mm_fault_error(regs, error_code, address, fault))
Paul Mundtdbdb4e92012-05-14 10:27:34 +0900483 return;
Kautuk Consul11fd9822012-03-31 08:06:11 -0400484
485 if (flags & FAULT_FLAG_ALLOW_RETRY) {
486 if (fault & VM_FAULT_MAJOR) {
487 tsk->maj_flt++;
488 perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MAJ, 1,
489 regs, address);
490 } else {
491 tsk->min_flt++;
492 perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MIN, 1,
493 regs, address);
494 }
495 if (fault & VM_FAULT_RETRY) {
496 flags &= ~FAULT_FLAG_ALLOW_RETRY;
497
498 /*
499 * No need to up_read(&mm->mmap_sem) as we would
500 * have already released it in __lock_page_or_retry
501 * in mm/filemap.c.
502 */
503 goto retry;
504 }
Paul Mundt7433ab7702009-06-25 02:30:10 +0900505 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700506
507 up_read(&mm->mmap_sem);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700508}