aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm
diff options
context:
space:
mode:
authorJohannes Weiner <hannes@cmpxchg.org>2013-09-12 18:13:38 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2013-09-12 18:38:01 -0400
commit871341023c771ad233620b7a1fb3d9c7031c4e5c (patch)
treef2b008756dffce639759f74885b23e92886600d6 /arch/arm
parent94bce453c78996cc4373d5da6cfabe07fcc6d9f9 (diff)
arch: mm: do not invoke OOM killer on kernel fault OOM
Kernel faults are expected to handle OOM conditions gracefully (gup, uaccess etc.), so they should never invoke the OOM killer. Reserve this for faults triggered in user context when it is the only option. Most architectures already do this, fix up the remaining few. Signed-off-by: Johannes Weiner <hannes@cmpxchg.org> Reviewed-by: Michal Hocko <mhocko@suse.cz> Acked-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com> Cc: David Rientjes <rientjes@google.com> Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> Cc: azurIt <azurit@pobox.sk> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch/arm')
-rw-r--r--arch/arm/mm/fault.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/arch/arm/mm/fault.c b/arch/arm/mm/fault.c
index c97f7940cb95..217bcbfde42e 100644
--- a/arch/arm/mm/fault.c
+++ b/arch/arm/mm/fault.c
@@ -349,6 +349,13 @@ retry:
349 if (likely(!(fault & (VM_FAULT_ERROR | VM_FAULT_BADMAP | VM_FAULT_BADACCESS)))) 349 if (likely(!(fault & (VM_FAULT_ERROR | VM_FAULT_BADMAP | VM_FAULT_BADACCESS))))
350 return 0; 350 return 0;
351 351
352 /*
353 * If we are in kernel mode at this point, we
354 * have no context to handle this fault with.
355 */
356 if (!user_mode(regs))
357 goto no_context;
358
352 if (fault & VM_FAULT_OOM) { 359 if (fault & VM_FAULT_OOM) {
353 /* 360 /*
354 * We ran out of memory, call the OOM killer, and return to 361 * We ran out of memory, call the OOM killer, and return to
@@ -359,13 +366,6 @@ retry:
359 return 0; 366 return 0;
360 } 367 }
361 368
362 /*
363 * If we are in kernel mode at this point, we
364 * have no context to handle this fault with.
365 */
366 if (!user_mode(regs))
367 goto no_context;
368
369 if (fault & VM_FAULT_SIGBUS) { 369 if (fault & VM_FAULT_SIGBUS) {
370 /* 370 /*
371 * We had some memory, but were unable to 371 * We had some memory, but were unable to