aboutsummaryrefslogtreecommitdiffstats
path: root/arch/alpha
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/alpha
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/alpha')
-rw-r--r--arch/alpha/mm/fault.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/arch/alpha/mm/fault.c b/arch/alpha/mm/fault.c
index 0c4132dd3507..98838a05ba6d 100644
--- a/arch/alpha/mm/fault.c
+++ b/arch/alpha/mm/fault.c
@@ -89,8 +89,7 @@ do_page_fault(unsigned long address, unsigned long mmcsr,
89 const struct exception_table_entry *fixup; 89 const struct exception_table_entry *fixup;
90 int fault, si_code = SEGV_MAPERR; 90 int fault, si_code = SEGV_MAPERR;
91 siginfo_t info; 91 siginfo_t info;
92 unsigned int flags = (FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE | 92 unsigned int flags = FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE;
93 (cause > 0 ? FAULT_FLAG_WRITE : 0));
94 93
95 /* As of EV6, a load into $31/$f31 is a prefetch, and never faults 94 /* As of EV6, a load into $31/$f31 is a prefetch, and never faults
96 (or is suppressed by the PALcode). Support that for older CPUs 95 (or is suppressed by the PALcode). Support that for older CPUs
@@ -115,7 +114,8 @@ do_page_fault(unsigned long address, unsigned long mmcsr,
115 if (address >= TASK_SIZE) 114 if (address >= TASK_SIZE)
116 goto vmalloc_fault; 115 goto vmalloc_fault;
117#endif 116#endif
118 117 if (user_mode(regs))
118 flags |= FAULT_FLAG_USER;
119retry: 119retry:
120 down_read(&mm->mmap_sem); 120 down_read(&mm->mmap_sem);
121 vma = find_vma(mm, address); 121 vma = find_vma(mm, address);
@@ -142,6 +142,7 @@ retry:
142 } else { 142 } else {
143 if (!(vma->vm_flags & VM_WRITE)) 143 if (!(vma->vm_flags & VM_WRITE))
144 goto bad_area; 144 goto bad_area;
145 flags |= FAULT_FLAG_WRITE;
145 } 146 }
146 147
147 /* If for any reason at all we couldn't handle the fault, 148 /* If for any reason at all we couldn't handle the fault,