aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arc/mm
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/arc/mm
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/arc/mm')
-rw-r--r--arch/arc/mm/fault.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/arch/arc/mm/fault.c b/arch/arc/mm/fault.c
index 6b0bb415af40..d63f3de0cd5b 100644
--- a/arch/arc/mm/fault.c
+++ b/arch/arc/mm/fault.c
@@ -60,8 +60,7 @@ void do_page_fault(struct pt_regs *regs, unsigned long address)
60 siginfo_t info; 60 siginfo_t info;
61 int fault, ret; 61 int fault, ret;
62 int write = regs->ecr_cause & ECR_C_PROTV_STORE; /* ST/EX */ 62 int write = regs->ecr_cause & ECR_C_PROTV_STORE; /* ST/EX */
63 unsigned int flags = FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE | 63 unsigned int flags = FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE;
64 (write ? FAULT_FLAG_WRITE : 0);
65 64
66 /* 65 /*
67 * We fault-in kernel-space virtual memory on-demand. The 66 * We fault-in kernel-space virtual memory on-demand. The
@@ -89,6 +88,8 @@ void do_page_fault(struct pt_regs *regs, unsigned long address)
89 if (in_atomic() || !mm) 88 if (in_atomic() || !mm)
90 goto no_context; 89 goto no_context;
91 90
91 if (user_mode(regs))
92 flags |= FAULT_FLAG_USER;
92retry: 93retry:
93 down_read(&mm->mmap_sem); 94 down_read(&mm->mmap_sem);
94 vma = find_vma(mm, address); 95 vma = find_vma(mm, address);
@@ -117,6 +118,7 @@ good_area:
117 if (write) { 118 if (write) {
118 if (!(vma->vm_flags & VM_WRITE)) 119 if (!(vma->vm_flags & VM_WRITE))
119 goto bad_area; 120 goto bad_area;
121 flags |= FAULT_FLAG_WRITE;
120 } else { 122 } else {
121 if (!(vma->vm_flags & (VM_READ | VM_EXEC))) 123 if (!(vma->vm_flags & (VM_READ | VM_EXEC)))
122 goto bad_area; 124 goto bad_area;