]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
mm, oom: remove statically defined arch functions of same name
authorDavid Rientjes <rientjes@google.com>
Wed, 12 Dec 2012 21:52:10 +0000 (13:52 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 13 Dec 2012 01:38:34 +0000 (17:38 -0800)
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>
arch/powerpc/mm/fault.c
arch/sh/mm/fault.c
arch/x86/mm/fault.c

index 0a6b28336eb0791354c1dc4439ddddcc4e2b35d7..3a8489a354e94d16cb6d0ad6f165fbc1870f53c1 100644 (file)
@@ -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(&current->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(&current->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
index cbbdcad8fcb357cc7fc383820a6f0c7dc1537be9..1f49c28affa90495047c6b82577b2d5221bc089b 100644 (file)
@@ -301,17 +301,6 @@ bad_area_access_error(struct pt_regs *regs, unsigned long error_code,
        __bad_area(regs, error_code, address, SEGV_ACCERR);
 }
 
-static void out_of_memory(void)
-{
-       /*
-        * We ran out of memory, call the OOM killer, and return the userspace
-        * (which will retry the fault, or kill us if we got oom-killed):
-        */
-       up_read(&current->mm->mmap_sem);
-
-       pagefault_out_of_memory();
-}
-
 static void
 do_sigbus(struct pt_regs *regs, unsigned long error_code, unsigned long address)
 {
@@ -353,8 +342,14 @@ mm_fault_error(struct pt_regs *regs, unsigned long error_code,
                        no_context(regs, error_code, address);
                        return 1;
                }
+               up_read(&current->mm->mmap_sem);
 
-               out_of_memory();
+               /*
+                * We ran out of memory, call the OOM killer, and return the
+                * userspace (which will retry the fault, or kill us if we got
+                * oom-killed):
+                */
+               pagefault_out_of_memory();
        } else {
                if (fault & VM_FAULT_SIGBUS)
                        do_sigbus(regs, error_code, address);
index 7a529cbab7ad1dd96d70cdc323f6943c9219b8f7..027088f2f7dd9b6b836abfe410088579106a7324 100644 (file)
@@ -803,20 +803,6 @@ bad_area_access_error(struct pt_regs *regs, unsigned long error_code,
        __bad_area(regs, error_code, address, SEGV_ACCERR);
 }
 
-/* TODO: fixup for "mm-invoke-oom-killer-from-page-fault.patch" */
-static void
-out_of_memory(struct pt_regs *regs, unsigned long error_code,
-             unsigned long address)
-{
-       /*
-        * We ran out of memory, call the OOM killer, and return the userspace
-        * (which will retry the fault, or kill us if we got oom-killed):
-        */
-       up_read(&current->mm->mmap_sem);
-
-       pagefault_out_of_memory();
-}
-
 static void
 do_sigbus(struct pt_regs *regs, unsigned long error_code, unsigned long address,
          unsigned int fault)
@@ -879,7 +865,14 @@ mm_fault_error(struct pt_regs *regs, unsigned long error_code,
                        return 1;
                }
 
-               out_of_memory(regs, error_code, address);
+               up_read(&current->mm->mmap_sem);
+
+               /*
+                * We ran out of memory, call the OOM killer, and return the
+                * userspace (which will retry the fault, or kill us if we got
+                * oom-killed):
+                */
+               pagefault_out_of_memory();
        } else {
                if (fault & (VM_FAULT_SIGBUS|VM_FAULT_HWPOISON|
                             VM_FAULT_HWPOISON_LARGE))