aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/mm
diff options
context:
space:
mode:
authorDavid Rientjes <rientjes@google.com>2012-12-12 16:52:10 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2012-12-12 20:38:34 -0500
commitc2d23f919bafcbc2259f5257d9a7d729802f0e3a (patch)
treea3b7e4fba1636183fb16d5564a1fe45d5e297a06 /arch/powerpc/mm
parent0fa84a4bfa2aac8c04d45351b40765d61e1fd20d (diff)
mm, oom: remove statically defined arch functions of same name
out_of_memory() is a globally defined function to call the oom killer. x86, sh, and powerpc all use a function of the same name within file scope in their respective fault.c unnecessarily. Inline the functions into the pagefault handlers to clean the code up. Signed-off-by: David Rientjes <rientjes@google.com> Cc: Ingo Molnar <mingo@redhat.com> Cc: "H. Peter Anvin" <hpa@zytor.com> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Paul Mackerras <paulus@samba.org> Cc: Paul Mundt <lethal@linux-sh.org> Reviewed-by: Michal Hocko <mhocko@suse.cz> Reviewed-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@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/mm')
-rw-r--r--arch/powerpc/mm/fault.c27
1 files changed, 12 insertions, 15 deletions
diff --git a/arch/powerpc/mm/fault.c b/arch/powerpc/mm/fault.c
index 0a6b28336eb0..3a8489a354e9 100644
--- a/arch/powerpc/mm/fault.c
+++ b/arch/powerpc/mm/fault.c
@@ -113,19 +113,6 @@ static int store_updates_sp(struct pt_regs *regs)
113#define MM_FAULT_CONTINUE -1 113#define MM_FAULT_CONTINUE -1
114#define MM_FAULT_ERR(sig) (sig) 114#define MM_FAULT_ERR(sig) (sig)
115 115
116static int out_of_memory(struct pt_regs *regs)
117{
118 /*
119 * We ran out of memory, or some other thing happened to us that made
120 * us unable to handle the page fault gracefully.
121 */
122 up_read(&current->mm->mmap_sem);
123 if (!user_mode(regs))
124 return MM_FAULT_ERR(SIGKILL);
125 pagefault_out_of_memory();
126 return MM_FAULT_RETURN;
127}
128
129static int do_sigbus(struct pt_regs *regs, unsigned long address) 116static int do_sigbus(struct pt_regs *regs, unsigned long address)
130{ 117{
131 siginfo_t info; 118 siginfo_t info;
@@ -169,8 +156,18 @@ static int mm_fault_error(struct pt_regs *regs, unsigned long addr, int fault)
169 return MM_FAULT_CONTINUE; 156 return MM_FAULT_CONTINUE;
170 157
171 /* Out of memory */ 158 /* Out of memory */
172 if (fault & VM_FAULT_OOM) 159 if (fault & VM_FAULT_OOM) {
173 return out_of_memory(regs); 160 up_read(&current->mm->mmap_sem);
161
162 /*
163 * We ran out of memory, or some other thing happened to us that
164 * made us unable to handle the page fault gracefully.
165 */
166 if (!user_mode(regs))
167 return MM_FAULT_ERR(SIGKILL);
168 pagefault_out_of_memory();
169 return MM_FAULT_RETURN;
170 }
174 171
175 /* Bus error. x86 handles HWPOISON here, we'll add this if/when 172 /* Bus error. x86 handles HWPOISON here, we'll add this if/when
176 * we support the feature in HW 173 * we support the feature in HW