aboutsummaryrefslogtreecommitdiffstats
path: root/arch/tile
diff options
context:
space:
mode:
authorJohannes Weiner <hannes@cmpxchg.org>2013-09-12 18:13:39 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2013-09-12 18:38:01 -0400
commit759496ba6407c6994d6a5ce3a5e74937d7816208 (patch)
treeaeff8de8af36f70f2591114cef58c9ae7df25565 /arch/tile
parent871341023c771ad233620b7a1fb3d9c7031c4e5c (diff)
arch: mm: pass userspace fault flag to generic fault handler
Unlike global OOM handling, memory cgroup code will invoke the OOM killer in any OOM situation because it has no way of telling faults occuring in kernel context - which could be handled more gracefully - from user-triggered faults. Pass a flag that identifies faults originating in user space from the architecture-specific fault handlers to generic code so that memcg OOM handling can be improved. Signed-off-by: Johannes Weiner <hannes@cmpxchg.org> Reviewed-by: Michal Hocko <mhocko@suse.cz> Cc: David Rientjes <rientjes@google.com> Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> Cc: azurIt <azurit@pobox.sk> Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch/tile')
-rw-r--r--arch/tile/mm/fault.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/arch/tile/mm/fault.c b/arch/tile/mm/fault.c
index 4fd2c0f2a66d..4c288f199453 100644
--- a/arch/tile/mm/fault.c
+++ b/arch/tile/mm/fault.c
@@ -280,8 +280,7 @@ static int handle_page_fault(struct pt_regs *regs,
280 if (!is_page_fault) 280 if (!is_page_fault)
281 write = 1; 281 write = 1;
282 282
283 flags = (FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE | 283 flags = FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE;
284 (write ? FAULT_FLAG_WRITE : 0));
285 284
286 is_kernel_mode = !user_mode(regs); 285 is_kernel_mode = !user_mode(regs);
287 286
@@ -365,6 +364,9 @@ static int handle_page_fault(struct pt_regs *regs,
365 goto bad_area_nosemaphore; 364 goto bad_area_nosemaphore;
366 } 365 }
367 366
367 if (!is_kernel_mode)
368 flags |= FAULT_FLAG_USER;
369
368 /* 370 /*
369 * When running in the kernel we expect faults to occur only to 371 * When running in the kernel we expect faults to occur only to
370 * addresses in user space. All other faults represent errors in the 372 * addresses in user space. All other faults represent errors in the
@@ -425,6 +427,7 @@ good_area:
425#endif 427#endif
426 if (!(vma->vm_flags & VM_WRITE)) 428 if (!(vma->vm_flags & VM_WRITE))
427 goto bad_area; 429 goto bad_area;
430 flags |= FAULT_FLAG_WRITE;
428 } else { 431 } else {
429 if (!is_page_fault || !(vma->vm_flags & VM_READ)) 432 if (!is_page_fault || !(vma->vm_flags & VM_READ))
430 goto bad_area; 433 goto bad_area;