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>
This commit is contained in:

committed by
Linus Torvalds

parent
0fa84a4bfa
commit
c2d23f919b
@@ -113,19 +113,6 @@ static int store_updates_sp(struct pt_regs *regs)
|
||||
#define MM_FAULT_CONTINUE -1
|
||||
#define MM_FAULT_ERR(sig) (sig)
|
||||
|
||||
static int out_of_memory(struct pt_regs *regs)
|
||||
{
|
||||
/*
|
||||
* We ran out of memory, or some other thing happened to us that made
|
||||
* us unable to handle the page fault gracefully.
|
||||
*/
|
||||
up_read(¤t->mm->mmap_sem);
|
||||
if (!user_mode(regs))
|
||||
return MM_FAULT_ERR(SIGKILL);
|
||||
pagefault_out_of_memory();
|
||||
return MM_FAULT_RETURN;
|
||||
}
|
||||
|
||||
static int do_sigbus(struct pt_regs *regs, unsigned long address)
|
||||
{
|
||||
siginfo_t info;
|
||||
@@ -169,8 +156,18 @@ static int mm_fault_error(struct pt_regs *regs, unsigned long addr, int fault)
|
||||
return MM_FAULT_CONTINUE;
|
||||
|
||||
/* Out of memory */
|
||||
if (fault & VM_FAULT_OOM)
|
||||
return out_of_memory(regs);
|
||||
if (fault & VM_FAULT_OOM) {
|
||||
up_read(¤t->mm->mmap_sem);
|
||||
|
||||
/*
|
||||
* We ran out of memory, or some other thing happened to us that
|
||||
* made us unable to handle the page fault gracefully.
|
||||
*/
|
||||
if (!user_mode(regs))
|
||||
return MM_FAULT_ERR(SIGKILL);
|
||||
pagefault_out_of_memory();
|
||||
return MM_FAULT_RETURN;
|
||||
}
|
||||
|
||||
/* Bus error. x86 handles HWPOISON here, we'll add this if/when
|
||||
* we support the feature in HW
|
||||
|
Reference in New Issue
Block a user