aboutsummaryrefslogtreecommitdiffstats
path: root/arch/hexagon
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/hexagon
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/hexagon')
-rw-r--r--arch/hexagon/mm/vm_fault.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/arch/hexagon/mm/vm_fault.c b/arch/hexagon/mm/vm_fault.c
index 1bd276dbec7d..8704c9320032 100644
--- a/arch/hexagon/mm/vm_fault.c
+++ b/arch/hexagon/mm/vm_fault.c
@@ -53,8 +53,7 @@ void do_page_fault(unsigned long address, long cause, struct pt_regs *regs)
53 int si_code = SEGV_MAPERR; 53 int si_code = SEGV_MAPERR;
54 int fault; 54 int fault;
55 const struct exception_table_entry *fixup; 55 const struct exception_table_entry *fixup;
56 unsigned int flags = FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE | 56 unsigned int flags = FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE;
57 (cause > 0 ? FAULT_FLAG_WRITE : 0);
58 57
59 /* 58 /*
60 * If we're in an interrupt or have no user context, 59 * If we're in an interrupt or have no user context,
@@ -65,6 +64,8 @@ void do_page_fault(unsigned long address, long cause, struct pt_regs *regs)
65 64
66 local_irq_enable(); 65 local_irq_enable();
67 66
67 if (user_mode(regs))
68 flags |= FAULT_FLAG_USER;
68retry: 69retry:
69 down_read(&mm->mmap_sem); 70 down_read(&mm->mmap_sem);
70 vma = find_vma(mm, address); 71 vma = find_vma(mm, address);
@@ -96,6 +97,7 @@ good_area:
96 case FLT_STORE: 97 case FLT_STORE:
97 if (!(vma->vm_flags & VM_WRITE)) 98 if (!(vma->vm_flags & VM_WRITE))
98 goto bad_area; 99 goto bad_area;
100 flags |= FAULT_FLAG_WRITE;
99 break; 101 break;
100 } 102 }
101 103