aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc
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/powerpc
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/powerpc')
-rw-r--r--arch/powerpc/mm/fault.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/arch/powerpc/mm/fault.c b/arch/powerpc/mm/fault.c
index 2dd69bf4af46..51ab9e7e6c39 100644
--- a/arch/powerpc/mm/fault.c
+++ b/arch/powerpc/mm/fault.c
@@ -223,9 +223,6 @@ int __kprobes do_page_fault(struct pt_regs *regs, unsigned long address,
223 is_write = error_code & ESR_DST; 223 is_write = error_code & ESR_DST;
224#endif /* CONFIG_4xx || CONFIG_BOOKE */ 224#endif /* CONFIG_4xx || CONFIG_BOOKE */
225 225
226 if (is_write)
227 flags |= FAULT_FLAG_WRITE;
228
229#ifdef CONFIG_PPC_ICSWX 226#ifdef CONFIG_PPC_ICSWX
230 /* 227 /*
231 * we need to do this early because this "data storage 228 * we need to do this early because this "data storage
@@ -288,6 +285,9 @@ int __kprobes do_page_fault(struct pt_regs *regs, unsigned long address,
288 if (user_mode(regs)) 285 if (user_mode(regs))
289 store_update_sp = store_updates_sp(regs); 286 store_update_sp = store_updates_sp(regs);
290 287
288 if (user_mode(regs))
289 flags |= FAULT_FLAG_USER;
290
291 /* When running in the kernel we expect faults to occur only to 291 /* When running in the kernel we expect faults to occur only to
292 * addresses in user space. All other faults represent errors in the 292 * addresses in user space. All other faults represent errors in the
293 * kernel and should generate an OOPS. Unfortunately, in the case of an 293 * kernel and should generate an OOPS. Unfortunately, in the case of an
@@ -415,6 +415,7 @@ good_area:
415 } else if (is_write) { 415 } else if (is_write) {
416 if (!(vma->vm_flags & VM_WRITE)) 416 if (!(vma->vm_flags & VM_WRITE))
417 goto bad_area; 417 goto bad_area;
418 flags |= FAULT_FLAG_WRITE;
418 /* a read */ 419 /* a read */
419 } else { 420 } else {
420 /* protection fault */ 421 /* protection fault */