aboutsummaryrefslogtreecommitdiffstats
path: root/arch/cris/mm/fault.c
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/cris/mm/fault.c
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/cris/mm/fault.c')
-rw-r--r--arch/cris/mm/fault.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/arch/cris/mm/fault.c b/arch/cris/mm/fault.c
index 73312ab6c696..1790f22e71a2 100644
--- a/arch/cris/mm/fault.c
+++ b/arch/cris/mm/fault.c
@@ -58,8 +58,7 @@ do_page_fault(unsigned long address, struct pt_regs *regs,
58 struct vm_area_struct * vma; 58 struct vm_area_struct * vma;
59 siginfo_t info; 59 siginfo_t info;
60 int fault; 60 int fault;
61 unsigned int flags = FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE | 61 unsigned int flags = FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE;
62 ((writeaccess & 1) ? FAULT_FLAG_WRITE : 0);
63 62
64 D(printk(KERN_DEBUG 63 D(printk(KERN_DEBUG
65 "Page fault for %lX on %X at %lX, prot %d write %d\n", 64 "Page fault for %lX on %X at %lX, prot %d write %d\n",
@@ -117,6 +116,8 @@ do_page_fault(unsigned long address, struct pt_regs *regs,
117 if (in_atomic() || !mm) 116 if (in_atomic() || !mm)
118 goto no_context; 117 goto no_context;
119 118
119 if (user_mode(regs))
120 flags |= FAULT_FLAG_USER;
120retry: 121retry:
121 down_read(&mm->mmap_sem); 122 down_read(&mm->mmap_sem);
122 vma = find_vma(mm, address); 123 vma = find_vma(mm, address);
@@ -155,6 +156,7 @@ retry:
155 } else if (writeaccess == 1) { 156 } else if (writeaccess == 1) {
156 if (!(vma->vm_flags & VM_WRITE)) 157 if (!(vma->vm_flags & VM_WRITE))
157 goto bad_area; 158 goto bad_area;
159 flags |= FAULT_FLAG_WRITE;
158 } else { 160 } else {
159 if (!(vma->vm_flags & (VM_READ | VM_EXEC))) 161 if (!(vma->vm_flags & (VM_READ | VM_EXEC)))
160 goto bad_area; 162 goto bad_area;