Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Move FAULT_FLAG_xyz into handle_mm_fault() callers

This allows the callers to now pass down the full set of FAULT_FLAG_xyz
flags to handle_mm_fault(). All callers have been (mechanically)
converted to the new calling convention, there's almost certainly room
for architectures to clean up their code and then add FAULT_FLAG_RETRY
when that support is added.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

+30 -30
+1 -1
arch/alpha/mm/fault.c
··· 146 146 /* If for any reason at all we couldn't handle the fault, 147 147 make sure we exit gracefully rather than endlessly redo 148 148 the fault. */ 149 - fault = handle_mm_fault(mm, vma, address, cause > 0); 149 + fault = handle_mm_fault(mm, vma, address, cause > 0 ? FAULT_FLAG_WRITE : 0); 150 150 up_read(&mm->mmap_sem); 151 151 if (unlikely(fault & VM_FAULT_ERROR)) { 152 152 if (fault & VM_FAULT_OOM)
+1 -1
arch/arm/mm/fault.c
··· 208 208 * than endlessly redo the fault. 209 209 */ 210 210 survive: 211 - fault = handle_mm_fault(mm, vma, addr & PAGE_MASK, fsr & (1 << 11)); 211 + fault = handle_mm_fault(mm, vma, addr & PAGE_MASK, (fsr & (1 << 11)) ? FAULT_FLAG_WRITE : 0); 212 212 if (unlikely(fault & VM_FAULT_ERROR)) { 213 213 if (fault & VM_FAULT_OOM) 214 214 goto out_of_memory;
+1 -1
arch/avr32/mm/fault.c
··· 133 133 * fault. 134 134 */ 135 135 survive: 136 - fault = handle_mm_fault(mm, vma, address, writeaccess); 136 + fault = handle_mm_fault(mm, vma, address, writeaccess ? FAULT_FLAG_WRITE : 0); 137 137 if (unlikely(fault & VM_FAULT_ERROR)) { 138 138 if (fault & VM_FAULT_OOM) 139 139 goto out_of_memory;
+1 -1
arch/cris/mm/fault.c
··· 163 163 * the fault. 164 164 */ 165 165 166 - fault = handle_mm_fault(mm, vma, address, writeaccess & 1); 166 + fault = handle_mm_fault(mm, vma, address, (writeaccess & 1) ? FAULT_FLAG_WRITE : 0); 167 167 if (unlikely(fault & VM_FAULT_ERROR)) { 168 168 if (fault & VM_FAULT_OOM) 169 169 goto out_of_memory;
+1 -1
arch/frv/mm/fault.c
··· 163 163 * make sure we exit gracefully rather than endlessly redo 164 164 * the fault. 165 165 */ 166 - fault = handle_mm_fault(mm, vma, ear0, write); 166 + fault = handle_mm_fault(mm, vma, ear0, write ? FAULT_FLAG_WRITE : 0); 167 167 if (unlikely(fault & VM_FAULT_ERROR)) { 168 168 if (fault & VM_FAULT_OOM) 169 169 goto out_of_memory;
+1 -1
arch/ia64/mm/fault.c
··· 154 154 * sure we exit gracefully rather than endlessly redo the 155 155 * fault. 156 156 */ 157 - fault = handle_mm_fault(mm, vma, address, (mask & VM_WRITE) != 0); 157 + fault = handle_mm_fault(mm, vma, address, (mask & VM_WRITE) ? FAULT_FLAG_WRITE : 0); 158 158 if (unlikely(fault & VM_FAULT_ERROR)) { 159 159 /* 160 160 * We ran out of memory, or some other thing happened
+1 -1
arch/m32r/mm/fault.c
··· 196 196 */ 197 197 addr = (address & PAGE_MASK); 198 198 set_thread_fault_code(error_code); 199 - fault = handle_mm_fault(mm, vma, addr, write); 199 + fault = handle_mm_fault(mm, vma, addr, write ? FAULT_FLAG_WRITE : 0); 200 200 if (unlikely(fault & VM_FAULT_ERROR)) { 201 201 if (fault & VM_FAULT_OOM) 202 202 goto out_of_memory;
+1 -1
arch/m68k/mm/fault.c
··· 155 155 */ 156 156 157 157 survive: 158 - fault = handle_mm_fault(mm, vma, address, write); 158 + fault = handle_mm_fault(mm, vma, address, write ? FAULT_FLAG_WRITE : 0); 159 159 #ifdef DEBUG 160 160 printk("handle_mm_fault returns %d\n",fault); 161 161 #endif
+1 -1
arch/microblaze/mm/fault.c
··· 232 232 * the fault. 233 233 */ 234 234 survive: 235 - fault = handle_mm_fault(mm, vma, address, is_write); 235 + fault = handle_mm_fault(mm, vma, address, is_write ? FAULT_FLAG_WRITE : 0); 236 236 if (unlikely(fault & VM_FAULT_ERROR)) { 237 237 if (fault & VM_FAULT_OOM) 238 238 goto out_of_memory;
+1 -1
arch/mips/mm/fault.c
··· 102 102 * make sure we exit gracefully rather than endlessly redo 103 103 * the fault. 104 104 */ 105 - fault = handle_mm_fault(mm, vma, address, write); 105 + fault = handle_mm_fault(mm, vma, address, write ? FAULT_FLAG_WRITE : 0); 106 106 if (unlikely(fault & VM_FAULT_ERROR)) { 107 107 if (fault & VM_FAULT_OOM) 108 108 goto out_of_memory;
+1 -1
arch/mn10300/mm/fault.c
··· 258 258 * make sure we exit gracefully rather than endlessly redo 259 259 * the fault. 260 260 */ 261 - fault = handle_mm_fault(mm, vma, address, write); 261 + fault = handle_mm_fault(mm, vma, address, write ? FAULT_FLAG_WRITE : 0); 262 262 if (unlikely(fault & VM_FAULT_ERROR)) { 263 263 if (fault & VM_FAULT_OOM) 264 264 goto out_of_memory;
+1 -1
arch/parisc/mm/fault.c
··· 202 202 * fault. 203 203 */ 204 204 205 - fault = handle_mm_fault(mm, vma, address, (acc_type & VM_WRITE) != 0); 205 + fault = handle_mm_fault(mm, vma, address, (acc_type & VM_WRITE) ? FAULT_FLAG_WRITE : 0); 206 206 if (unlikely(fault & VM_FAULT_ERROR)) { 207 207 /* 208 208 * We hit a shared mapping outside of the file, or some
+1 -1
arch/powerpc/mm/fault.c
··· 302 302 * the fault. 303 303 */ 304 304 survive: 305 - ret = handle_mm_fault(mm, vma, address, is_write); 305 + ret = handle_mm_fault(mm, vma, address, is_write ? FAULT_FLAG_WRITE : 0); 306 306 if (unlikely(ret & VM_FAULT_ERROR)) { 307 307 if (ret & VM_FAULT_OOM) 308 308 goto out_of_memory;
+1 -1
arch/powerpc/platforms/cell/spu_fault.c
··· 70 70 } 71 71 72 72 ret = 0; 73 - *flt = handle_mm_fault(mm, vma, ea, is_write); 73 + *flt = handle_mm_fault(mm, vma, ea, is_write ? FAULT_FLAG_WRITE : 0); 74 74 if (unlikely(*flt & VM_FAULT_ERROR)) { 75 75 if (*flt & VM_FAULT_OOM) { 76 76 ret = -ENOMEM;
+1 -1
arch/s390/lib/uaccess_pt.c
··· 66 66 } 67 67 68 68 survive: 69 - fault = handle_mm_fault(mm, vma, address, write_access); 69 + fault = handle_mm_fault(mm, vma, address, write_access ? FAULT_FLAG_WRITE : 0); 70 70 if (unlikely(fault & VM_FAULT_ERROR)) { 71 71 if (fault & VM_FAULT_OOM) 72 72 goto out_of_memory;
+1 -1
arch/s390/mm/fault.c
··· 352 352 * make sure we exit gracefully rather than endlessly redo 353 353 * the fault. 354 354 */ 355 - fault = handle_mm_fault(mm, vma, address, write); 355 + fault = handle_mm_fault(mm, vma, address, write ? FAULT_FLAG_WRITE : 0); 356 356 if (unlikely(fault & VM_FAULT_ERROR)) { 357 357 if (fault & VM_FAULT_OOM) { 358 358 up_read(&mm->mmap_sem);
+1 -1
arch/sh/mm/fault_32.c
··· 133 133 * the fault. 134 134 */ 135 135 survive: 136 - fault = handle_mm_fault(mm, vma, address, writeaccess); 136 + fault = handle_mm_fault(mm, vma, address, writeaccess ? FAULT_FLAG_WRITE : 0); 137 137 if (unlikely(fault & VM_FAULT_ERROR)) { 138 138 if (fault & VM_FAULT_OOM) 139 139 goto out_of_memory;
+1 -1
arch/sh/mm/tlbflush_64.c
··· 187 187 * the fault. 188 188 */ 189 189 survive: 190 - fault = handle_mm_fault(mm, vma, address, writeaccess); 190 + fault = handle_mm_fault(mm, vma, address, writeaccess ? FAULT_FLAG_WRITE : 0); 191 191 if (unlikely(fault & VM_FAULT_ERROR)) { 192 192 if (fault & VM_FAULT_OOM) 193 193 goto out_of_memory;
+2 -2
arch/sparc/mm/fault_32.c
··· 241 241 * make sure we exit gracefully rather than endlessly redo 242 242 * the fault. 243 243 */ 244 - fault = handle_mm_fault(mm, vma, address, write); 244 + fault = handle_mm_fault(mm, vma, address, write ? FAULT_FLAG_WRITE : 0); 245 245 if (unlikely(fault & VM_FAULT_ERROR)) { 246 246 if (fault & VM_FAULT_OOM) 247 247 goto out_of_memory; ··· 484 484 if(!(vma->vm_flags & (VM_READ | VM_EXEC))) 485 485 goto bad_area; 486 486 } 487 - switch (handle_mm_fault(mm, vma, address, write)) { 487 + switch (handle_mm_fault(mm, vma, address, write ? FAULT_FLAG_WRITE : 0)) { 488 488 case VM_FAULT_SIGBUS: 489 489 case VM_FAULT_OOM: 490 490 goto do_sigbus;
+1 -1
arch/sparc/mm/fault_64.c
··· 398 398 goto bad_area; 399 399 } 400 400 401 - fault = handle_mm_fault(mm, vma, address, (fault_code & FAULT_CODE_WRITE)); 401 + fault = handle_mm_fault(mm, vma, address, (fault_code & FAULT_CODE_WRITE) ? FAULT_FLAG_WRITE : 0); 402 402 if (unlikely(fault & VM_FAULT_ERROR)) { 403 403 if (fault & VM_FAULT_OOM) 404 404 goto out_of_memory;
+1 -1
arch/um/kernel/trap.c
··· 65 65 do { 66 66 int fault; 67 67 68 - fault = handle_mm_fault(mm, vma, address, is_write); 68 + fault = handle_mm_fault(mm, vma, address, is_write ? FAULT_FLAG_WRITE : 0); 69 69 if (unlikely(fault & VM_FAULT_ERROR)) { 70 70 if (fault & VM_FAULT_OOM) { 71 71 goto out_of_memory;
+1 -1
arch/x86/mm/fault.c
··· 1113 1113 * make sure we exit gracefully rather than endlessly redo 1114 1114 * the fault: 1115 1115 */ 1116 - fault = handle_mm_fault(mm, vma, address, write); 1116 + fault = handle_mm_fault(mm, vma, address, write ? FAULT_FLAG_WRITE : 0); 1117 1117 1118 1118 if (unlikely(fault & VM_FAULT_ERROR)) { 1119 1119 mm_fault_error(regs, error_code, address, fault);
+1 -1
arch/xtensa/mm/fault.c
··· 106 106 * the fault. 107 107 */ 108 108 survive: 109 - fault = handle_mm_fault(mm, vma, address, is_write); 109 + fault = handle_mm_fault(mm, vma, address, is_write ? FAULT_FLAG_WRITE : 0); 110 110 if (unlikely(fault & VM_FAULT_ERROR)) { 111 111 if (fault & VM_FAULT_OOM) 112 112 goto out_of_memory;
+2 -2
include/linux/mm.h
··· 810 810 811 811 #ifdef CONFIG_MMU 812 812 extern int handle_mm_fault(struct mm_struct *mm, struct vm_area_struct *vma, 813 - unsigned long address, int write_access); 813 + unsigned long address, unsigned int flags); 814 814 #else 815 815 static inline int handle_mm_fault(struct mm_struct *mm, 816 816 struct vm_area_struct *vma, unsigned long address, 817 - int write_access) 817 + unsigned int flags) 818 818 { 819 819 /* should never happen if there's no MMU */ 820 820 BUG();
+4 -4
mm/memory.c
··· 1310 1310 cond_resched(); 1311 1311 while (!(page = follow_page(vma, start, foll_flags))) { 1312 1312 int ret; 1313 - ret = handle_mm_fault(mm, vma, start, 1314 - foll_flags & FOLL_WRITE); 1313 + 1314 + /* FOLL_WRITE matches FAULT_FLAG_WRITE! */ 1315 + ret = handle_mm_fault(mm, vma, start, foll_flags & FOLL_WRITE); 1315 1316 if (ret & VM_FAULT_ERROR) { 1316 1317 if (ret & VM_FAULT_OOM) 1317 1318 return i ? i : -ENOMEM; ··· 2959 2958 * By the time we get here, we already hold the mm semaphore 2960 2959 */ 2961 2960 int handle_mm_fault(struct mm_struct *mm, struct vm_area_struct *vma, 2962 - unsigned long address, int write_access) 2961 + unsigned long address, unsigned int flags) 2963 2962 { 2964 2963 pgd_t *pgd; 2965 2964 pud_t *pud; 2966 2965 pmd_t *pmd; 2967 2966 pte_t *pte; 2968 - unsigned int flags = write_access ? FAULT_FLAG_WRITE : 0; 2969 2967 2970 2968 __set_current_state(TASK_RUNNING); 2971 2969