Skip to contentSkip to conversation

convert remaining architectures to pagefault_out_of_memory()

PATCH Applied [email protected] 10 participants 41 messages Apr 22, 2010 – Apr 28, 2010

Subsystems (8)
lore
Share & tools
lore
#0 lore raw

cover convert remaining architectures to pagefault_out_of_memory()

Hi,

The following patches convert the rest of the architectures to use pagefault_on_out_of_memory. The reason is to provide a consistent architecture independent page fault hook that the kernel can use. Also see commit 1c0fe6e3bd

x86, arm, mips, sparc, s390, uml are already using this.

Subsequent patches will be sent to arch maintainers and cc'ed to linux-arch.

Thanks,
Nick

#1 lore raw

PATCH 1/14 alpha: invoke oom-killer from page fault

As explained in commit 1c0fe6e3bd, we want to call the architecture independent oom killer when getting an unexplained OOM from handle_mm_fault, rather than simply killing current.

---

arch/alpha/mm/fault.c +2 -8
Index: linux-2.6/arch/alpha/mm/fault.c
===================================================================
@@ -188,16 +188,10 @@ do_page_fault(unsigned long address, uns
 	/* We ran out of memory, or some other thing happened to us that
 	   made us unable to handle the page fault gracefully.  */
  out_of_memory:
-	if (is_global_init(current)) {
-		yield();
-		down_read(&mm->mmap_sem);
-		goto survive;
-	}
-	printk(KERN_ALERT "VM: killing process %s(%d)\n",
-	       current->comm, task_pid_nr(current));
 	if (!user_mode(regs))
 		goto no_context;
-	do_group_exit(SIGKILL);
+	pagefault_out_of_memory();
+	return;
 
  do_sigbus:
 	/* Send a sigbus, regardless of whether we were in kernel
Acked-by on v1 1/14
#2 lore raw

Re: [patch 01/14] alpha: invoke oom-killer from page fault

Quoted 8 lines · On Fri, 23 Apr 2010, [email protected] wrote:

As explained in commit 1c0fe6e3bd, we want to call the architecture independent oom killer when getting an unexplained OOM from handle_mm_fault, rather than simply killing current.

Acked-by on v1 1/14
#3 lore raw

Re: [patch 01/14] alpha: invoke oom-killer from page fault

In reply to [email protected]
Quoted 8 lines · On Fri, 23 Apr 2010, [email protected] wrote:

As explained in commit 1c0fe6e3bd, we want to call the architecture independent oom killer when getting an unexplained OOM from handle_mm_fault, rather than simply killing current.

maintainer
#4 lore raw

Re: [patch 01/14] alpha: invoke oom-killer from page fault

In reply to [email protected]
Quoted 30 lines · On Thu, Apr 22, 2010 at 12:06 PM, <[email protected]> wrote:

As explained in commit 1c0fe6e3bd, we want to call the architecture independent oom killer when getting an unexplained OOM from handle_mm_fault, rather than simply killing current.

---
Index: linux-2.6/arch/alpha/mm/fault.c
===================================================================

arch/alpha/mm/fault.c +0 -0
@@ -188,16 +188,10 @@ do_page_fault(unsigned long address, uns
        /* We ran out of memory, or some other thing happened to us that

          made us unable to handle the page fault gracefully.  */ out_of_memory:
-       if (is_global_init(current)) {
-               yield();
-               down_read(&mm->mmap_sem);
-               goto survive;
-       }
-       printk(KERN_ALERT "VM: killing process %s(%d)\n",
-              current->comm, task_pid_nr(current));
       if (!user_mode(regs))
               goto no_context;
-       do_group_exit(SIGKILL);
+       pagefault_out_of_memory();
+       return;

Quoted 9 lines

 do_sigbus:
       /* Send a sigbus, regardless of whether we were in kernel

--
To unsubscribe from this list: send the line "unsubscribe linux-alpha" in the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Thanks, added to my tree.

Matt

maintainer
#5 lore raw

Re: [patch 01/14] alpha: invoke oom-killer from page fault

Quoted 43 lines · Matt Turner
Quoted 30 lines · On Thu, Apr 22, 2010 at 12:06 PM,  <[email protected]> wrote:

As explained in commit 1c0fe6e3bd, we want to call the architecture independent oom killer when getting an unexplained OOM from handle_mm_fault, rather than simply killing current.

---
Index: linux-2.6/arch/alpha/mm/fault.c
===================================================================

arch/alpha/mm/fault.c +0 -0
@@ -188,16 +188,10 @@ do_page_fault(unsigned long address, uns
        /* We ran out of memory, or some other thing happened to us that

          made us unable to handle the page fault gracefully.  */ out_of_memory:
-       if (is_global_init(current)) {
-               yield();
-               down_read(&mm->mmap_sem);
-               goto survive;
-       }
-       printk(KERN_ALERT "VM: killing process %s(%d)\n",
-              current->comm, task_pid_nr(current));
       if (!user_mode(regs))
               goto no_context;
-       do_group_exit(SIGKILL);
+       pagefault_out_of_memory();
+       return;

Quoted 9 lines

 do_sigbus:
       /* Send a sigbus, regardless of whether we were in kernel

--
To unsubscribe from this list: send the line "unsubscribe linux-alpha" in the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Thanks, added to my tree.

Quoted 2 lines

Matt

FYI: I had to kill off the now unused 'survive' label. Please check this in my tree at
http://git.kernel.org/?p=linux/kernel/git/mattst88/alpha-2.6.git;a=summary
to make sure it's correct.

Matt

#6 lore raw

PATCH 2/14 avr32: invoke oom-killer from page fault

In reply to [email protected]

As explained in commit 1c0fe6e3bd, we want to call the architecture independent oom killer when getting an unexplained OOM from handle_mm_fault, rather than simply killing current.

---

arch/avr32/mm/fault.c +4 -9
Index: linux-2.6/arch/avr32/mm/fault.c
===================================================================
@@ -211,15 +211,10 @@ no_context:
 	 */
 out_of_memory:
 	up_read(&mm->mmap_sem);
-	if (is_global_init(current)) {
-		yield();
-		down_read(&mm->mmap_sem);
-		goto survive;
-	}
-	printk("VM: Killing process %s\n", tsk->comm);
-	if (user_mode(regs))
-		do_group_exit(SIGKILL);
-	goto no_context;
+	pagefault_out_of_memory();
+	if (!user_mode(regs))
+		goto no_context;
+	return;
 
 do_sigbus:
 	up_read(&mm->mmap_sem);
#7 lore raw

Re: [patch 02/14] avr32: invoke oom-killer from page fault

Quoted 18 lines · On Fri, 23 Apr 2010, [email protected] wrote:

As explained in commit 1c0fe6e3bd, we want to call the architecture independent oom killer when getting an unexplained OOM from handle_mm_fault, rather than simply killing current.

---
Index: linux-2.6/arch/avr32/mm/fault.c
===================================================================

arch/avr32/mm/fault.c +0 -2
@@ -211,15 +211,10 @@ no_context:
 	 */
 out_of_memory:
 	up_read(&mm->mmap_sem);
-	if (is_global_init(current)) {
-		yield();

arch/avr32/mm/fault.c no_context: · line 216

Quoted 10 lines
arch/avr32/mm/fault.c +3 -7
-		down_read(&mm->mmap_sem);
-		goto survive;
-	}
-	printk("VM: Killing process %s\n", tsk->comm);
-	if (user_mode(regs))
-		do_group_exit(SIGKILL);
-	goto no_context;
+	pagefault_out_of_memory();
+	if (!user_mode(regs))
+		goto no_context;

We want to test for !user_mode(regs) before calling pagefault_out_of_memory().

Quoted 4 lines
arch/avr32/mm/fault.c +1 -0
+	return;
 
 do_sigbus:
 	up_read(&mm->mmap_sem);
#8 lore raw

Re: [patch 02/14] avr32: invoke oom-killer from page fault

Quoted 25 lines · David Rientjes
Quoted 23 lines · On Fri, 23 Apr 2010, [email protected] wrote:

As explained in commit 1c0fe6e3bd, we want to call the architecture independent oom killer when getting an unexplained OOM from handle_mm_fault, rather than simply killing current.

---
Index: linux-2.6/arch/avr32/mm/fault.c
===================================================================

arch/avr32/mm/fault.c +0 -7
@@ -211,15 +211,10 @@ no_context:
 	 */
 out_of_memory:
 	up_read(&mm->mmap_sem);
-	if (is_global_init(current)) {
-		yield();
-		down_read(&mm->mmap_sem);
-		goto survive;
-	}
-	printk("VM: Killing process %s\n", tsk->comm);
-	if (user_mode(regs))
Quoted 8 lines

arch/avr32/mm/fault.c no_context: · line 216

Quoted 5 lines
arch/avr32/mm/fault.c +3 -2
-		do_group_exit(SIGKILL);
-	goto no_context;
+	pagefault_out_of_memory();
+	if (!user_mode(regs))
+		goto no_context;

We want to test for !user_mode(regs) before calling pagefault_out_of_memory().

Thanks for the careful review. We do indeed.

#9 lore raw

PATCH 3/14 cris: invoke oom-killer from page fault

In reply to [email protected]

As explained in commit 1c0fe6e3bd, we want to call the architecture independent oom killer when getting an unexplained OOM from handle_mm_fault, rather than simply killing current.

---

arch/cris/mm/fault.c +4 -4
Index: linux-2.6/arch/cris/mm/fault.c
===================================================================
@@ -245,10 +245,10 @@ do_page_fault(unsigned long address, str
 
  out_of_memory:
 	up_read(&mm->mmap_sem);
-	printk("VM: killing process %s\n", tsk->comm);
-	if (user_mode(regs))
-		do_exit(SIGKILL);
-	goto no_context;
+	if (!user_mode(regs))
+		goto no_context;
+	pagefault_out_of_memory();
+	return;
 
  do_sigbus:
 	up_read(&mm->mmap_sem);
Acked-by on v1 3/14
#10 lore raw

Re: [patch 03/14] cris: invoke oom-killer from page fault

Quoted 8 lines · On Fri, 23 Apr 2010, [email protected] wrote:

As explained in commit 1c0fe6e3bd, we want to call the architecture independent oom killer when getting an unexplained OOM from handle_mm_fault, rather than simply killing current.

#11 lore raw

RE: [patch 03/14] cris: invoke oom-killer from page fault

In reply to [email protected]

-----Original Message-----
From: [email protected] [mailto:[email protected]]
Sent: den 22 april 2010 18:06
To: [email protected]
Cc: David Rientjes; Andrew Morton; linux-cris-kernel; Mikael Starvik
Subject: [patch 03/14] cris: invoke oom-killer from page fault

As explained in commit 1c0fe6e3bd, we want to call the architecture independent oom killer when getting an unexplained OOM from handle_mm_fault, rather than simply killing current.

---

arch/cris/mm/fault.c +4 -4
Index: linux-2.6/arch/cris/mm/fault.c
===================================================================
@@ -245,10 +245,10 @@ do_page_fault(unsigned long address, str
 
  out_of_memory:
 	up_read(&mm->mmap_sem);
-	printk("VM: killing process %s\n", tsk->comm);
-	if (user_mode(regs))
-		do_exit(SIGKILL);
-	goto no_context;
+	if (!user_mode(regs))
+		goto no_context;
+	pagefault_out_of_memory();
+	return;
 
  do_sigbus:
 	up_read(&mm->mmap_sem);
#12 lore raw

PATCH 4/14 frv: invoke oom-killer from page fault

In reply to [email protected]

As explained in commit 1c0fe6e3bd, we want to call the architecture independent oom killer when getting an unexplained OOM from handle_mm_fault, rather than simply killing current.

---

arch/frv/mm/fault.c +4 -4
Index: linux-2.6/arch/frv/mm/fault.c
===================================================================
@@ -257,10 +257,10 @@ asmlinkage void do_page_fault(int datamm
  */
  out_of_memory:
 	up_read(&mm->mmap_sem);
-	printk("VM: killing process %s\n", current->comm);
-	if (user_mode(__frame))
-		do_group_exit(SIGKILL);
-	goto no_context;
+	if (!user_mode(__frame))
+		goto no_context;
+	pagefault_out_of_memory();
+	return;
 
  do_sigbus:
 	up_read(&mm->mmap_sem);
Acked-by on v1 4/14
#13 lore raw

Re: [patch 04/14] frv: invoke oom-killer from page fault

Quoted 7 lines · On Fri, 23 Apr 2010, [email protected] wrote:

As explained in commit 1c0fe6e3bd, we want to call the architecture independent oom killer when getting an unexplained OOM from handle_mm_fault, rather than simply killing current.

Acked-by on v1 4/14
#14 lore raw

Re: [patch 04/14] frv: invoke oom-killer from page fault

In reply to [email protected]
Quoted 7 lines · [email protected] wrote:

As explained in commit 1c0fe6e3bd, we want to call the architecture independent oom killer when getting an unexplained OOM from handle_mm_fault, rather than simply killing current.

#15 lore raw

PATCH 5/14 ia64: invoke oom-killer from page fault

In reply to [email protected]

As explained in commit 1c0fe6e3bd, we want to call the architecture independent oom killer when getting an unexplained OOM from handle_mm_fault, rather than simply killing current.

---
Index: linux-2.6/arch/ia64/mm/fault.c =================================--- linux-2.6.orig/arch/ia64/mm/fault.c +++ linux-2.6/arch/ia64/mm/fault.c
@@ -276,13 +276,7 @@ ia64_do_page_fault (unsigned long addres

out_of_memory:
up_read(&mm->mmap_sem);
- if (is_global_init(current)) {
- yield();
- down_read(&mm->mmap_sem);
- goto survive;
- }
- printk(KERN_CRIT "VM: killing process %s\n", current->comm);
- if (user_mode(regs))
- do_group_exit(SIGKILL);
- goto no_context;
+ if (!user_mode(regs))
+ goto no_context;
+ pagefault_out_of_memory();
}

Acked-by on v1 5/14
#16 lore raw

Re: [patch 05/14] ia64: invoke oom-killer from page fault

Quoted 8 lines · On Fri, 23 Apr 2010, [email protected] wrote:

As explained in commit 1c0fe6e3bd, we want to call the architecture independent oom killer when getting an unexplained OOM from handle_mm_fault, rather than simply killing current.

Quoted 24 lines

---
Index: linux-2.6/arch/ia64/mm/fault.c =================================> --- linux-2.6.orig/arch/ia64/mm/fault.c +++ linux-2.6/arch/ia64/mm/fault.c

(quoted diff) +3 -9
@@ -276,13 +276,7 @@ ia64_do_page_fault (unsigned long addres
 
   out_of_memory:
 	up_read(&mm->mmap_sem);
-	if (is_global_init(current)) {
-		yield();
-		down_read(&mm->mmap_sem);
-		goto survive;
-	}
-	printk(KERN_CRIT "VM: killing process %s\n", current->comm);
-	if (user_mode(regs))
-		do_group_exit(SIGKILL);
-	goto no_context;
+	if (!user_mode(regs))
+		goto no_context;
+	pagefault_out_of_memory();
 }
#17 lore raw

PATCH 6/14 m32r: invoke oom-killer from page fault

In reply to [email protected]

As explained in commit 1c0fe6e3bd, we want to call the architecture independent oom killer when getting an unexplained OOM from handle_mm_fault, rather than simply killing current.

---

arch/m32r/mm/fault.c +3 -8
Index: linux-2.6/arch/m32r/mm/fault.c
===================================================================
@@ -271,15 +271,10 @@ no_context:
  */
 out_of_memory:
 	up_read(&mm->mmap_sem);
-	if (is_global_init(tsk)) {
-		yield();
-		down_read(&mm->mmap_sem);
-		goto survive;
-	}
-	printk("VM: killing process %s\n", tsk->comm);
 	if (error_code & ACE_USERMODE)
-		do_group_exit(SIGKILL);
-	goto no_context;
+		goto no_context;
+	pagefault_out_of_memory();
+	return;
 
 do_sigbus:
 	up_read(&mm->mmap_sem);
#18 lore raw

Re: [patch 06/14] m32r: invoke oom-killer from page fault

Quoted 14 lines · On Fri, 23 Apr 2010, [email protected] wrote:

As explained in commit 1c0fe6e3bd, we want to call the architecture independent oom killer when getting an unexplained OOM from handle_mm_fault, rather than simply killing current.

---
Index: linux-2.6/arch/m32r/mm/fault.c
===================================================================

arch/m32r/mm/fault.c no_context: · line 274

Quoted 10 lines
arch/m32r/mm/fault.c +0 -6
@@ -271,15 +271,10 @@ no_context:
  */
 out_of_memory:
 	up_read(&mm->mmap_sem);
-	if (is_global_init(tsk)) {
-		yield();
-		down_read(&mm->mmap_sem);
-		goto survive;
-	}
-	printk("VM: killing process %s\n", tsk->comm);
 	if (error_code & ACE_USERMODE)

This should be !(error_code & ACE_USERMODE) instead.

Quoted 11 lines
arch/m32r/mm/fault.c +3 -2
-		do_group_exit(SIGKILL);
-	goto no_context;
+		goto no_context;
+	pagefault_out_of_memory();
+	return;
 
 do_sigbus:
 	up_read(&mm->mmap_sem);
#19 lore raw

PATCH 7/14 m68k: invoke oom-killer from page fault

In reply to [email protected]

As explained in commit 1c0fe6e3bd, we want to call the architecture independent oom killer when getting an unexplained OOM from handle_mm_fault, rather than simply killing current.

---

arch/m68k/mm/fault.c +4 -9
Index: linux-2.6/arch/m68k/mm/fault.c
===================================================================
@@ -180,15 +180,10 @@ good_area:
  */
 out_of_memory:
 	up_read(&mm->mmap_sem);
-	if (is_global_init(current)) {
-		yield();
-		down_read(&mm->mmap_sem);
-		goto survive;
-	}
-
-	printk("VM: killing process %s\n", current->comm);
-	if (user_mode(regs))
-		do_group_exit(SIGKILL);
+	if (!user_mode(regs))
+		goto no_context;
+	pagefault_out_of_memory();
+	return;
 
 no_context:
 	current->thread.signo = SIGBUS;
Acked-by on v1 7/14
#20 lore raw

Re: [patch 07/14] m68k: invoke oom-killer from page fault

Quoted 8 lines · On Fri, 23 Apr 2010, [email protected] wrote:

As explained in commit 1c0fe6e3bd, we want to call the architecture independent oom killer when getting an unexplained OOM from handle_mm_fault, rather than simply killing current.

#21 lore raw

Re: [patch 07/14] m68k: invoke oom-killer from page fault

In reply to [email protected]
Quoted 31 lines · On Thu, Apr 22, 2010 at 18:06, <[email protected]> wrote:

As explained in commit 1c0fe6e3bd, we want to call the architecture independent oom killer when getting an unexplained OOM from handle_mm_fault, rather than simply killing current.

---
Index: linux-2.6/arch/m68k/mm/fault.c
===================================================================

arch/m68k/mm/fault.c +0 -0
@@ -180,15 +180,10 @@ good_area:
  */

 out_of_memory:
       up_read(&mm->mmap_sem);
-       if (is_global_init(current)) {
-               yield();
-               down_read(&mm->mmap_sem);
-               goto survive;
-       }
-
-       printk("VM: killing process %s\n", current->comm);
-       if (user_mode(regs))
-               do_group_exit(SIGKILL);
+       if (!user_mode(regs))
+               goto no_context;
+       pagefault_out_of_memory();
+       return;

Quoted 2 lines

 no_context:
       current->thread.signo = SIGBUS;

Will apply after unintroducing 2 compiler warnings::

arch/m68k/mm/fault.c +1 -2
index 0adfcb6..2db6099 100644
@@ -140,7 +140,6 @@ good_area:
 	 * the fault.
 	 */
 
- survive:
 	fault = handle_mm_fault(mm, vma, address, write ? FAULT_FLAG_WRITE : 0);
 #ifdef DEBUG
 	printk("handle_mm_fault returns %d\n",fault);
@@ -169,7 +168,7 @@ out_of_memory:
 	if (!user_mode(regs))
 		goto no_context;
 	pagefault_out_of_memory();
-	return;
+	return 0;
 
 no_context:
 	current->thread.signo = SIGBUS;

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

#22 lore raw

PATCH 8/14 microblaze: invoke oom-killer from page fault

In reply to [email protected]

As explained in commit 1c0fe6e3bd, we want to call the architecture independent oom killer when getting an unexplained OOM from handle_mm_fault, rather than simply killing current.

---

arch/microblaze/mm/fault.c +4 -9
Index: linux-2.6/arch/microblaze/mm/fault.c
===================================================================
@@ -273,16 +273,11 @@ bad_area_nosemaphore:
  * us unable to handle the page fault gracefully.
  */
 out_of_memory:
-	if (current->pid == 1) {
-		yield();
-		down_read(&mm->mmap_sem);
-		goto survive;
-	}
 	up_read(&mm->mmap_sem);
-	printk(KERN_WARNING "VM: killing process %s\n", current->comm);
-	if (user_mode(regs))
-		do_exit(SIGKILL);
-	bad_page_fault(regs, address, SIGKILL);
+	if (!user_mode(regs))
+		bad_page_fault(regs, address, SIGKILL);
+	else
+		pagefault_out_of_memory();
 	return;
 
 do_sigbus:
Acked-by on v1 8/14
#23 lore raw

Re: [patch 08/14] microblaze: invoke oom-killer from page fault

Quoted 8 lines · On Fri, 23 Apr 2010, [email protected] wrote:

As explained in commit 1c0fe6e3bd, we want to call the architecture independent oom killer when getting an unexplained OOM from handle_mm_fault, rather than simply killing current.

maintainer Applied
#24 lore raw

Re: [patch 08/14] microblaze: invoke oom-killer from page fault

Quoted 6 lines · David Rientjes
Quoted 4 lines · On Fri, 23 Apr 2010, [email protected] wrote:

As explained in commit 1c0fe6e3bd, we want to call the architecture independent oom killer when getting an unexplained OOM from handle_mm_fault, rather than simply killing current.

Quoted 6 lines
Quoted 4 lines

Applied to microblaze repository.

Thanks,
Michal

Signature · 4 lines
Michal Simek, Ing. (M.Eng)
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel 2.6 Microblaze Linux - http://www.monstr.eu/fdt/
Microblaze U-BOOT custodian
#25 lore raw

PATCH 9/14 mn10300: invoke oom-killer from page fault

In reply to [email protected]

As explained in commit 1c0fe6e3bd, we want to call the architecture independent oom killer when getting an unexplained OOM from handle_mm_fault, rather than simply killing current.

---

arch/mn10300/mm/fault.c +4 -5
Index: linux-2.6/arch/mn10300/mm/fault.c
===================================================================
@@ -338,11 +338,10 @@ no_context:
  */
 out_of_memory:
 	up_read(&mm->mmap_sem);
-	monitor_signal(regs);
-	printk(KERN_ALERT "VM: killing process %s\n", tsk->comm);
-	if ((fault_code & MMUFCR_xFC_ACCESS) == MMUFCR_xFC_ACCESS_USR)
-		do_exit(SIGKILL);
-	goto no_context;
+	if ((fault_code & MMUFCR_xFC_ACCESS) != MMUFCR_xFC_ACCESS_USR)
+		goto no_context;
+	pagefault_out_of_memory();
+	return;
 
 do_sigbus:
 	up_read(&mm->mmap_sem);
Acked-by on v1 9/14
#26 lore raw

Re: [patch 09/14] mn10300: invoke oom-killer from page fault

Quoted 8 lines · [email protected] wrote:

As explained in commit 1c0fe6e3bd, we want to call the architecture independent oom killer when getting an unexplained OOM from handle_mm_fault, rather than simply killing current.

#27 lore raw

PATCH 10/14 parisc: invoke oom-killer from page fault

In reply to [email protected]

As explained in commit 1c0fe6e3bd, we want to call the architecture independent oom killer when getting an unexplained OOM from handle_mm_fault, rather than simply killing current.

---

arch/parisc/mm/fault.c +3 -4
Index: linux-2.6/arch/parisc/mm/fault.c
===================================================================
@@ -264,8 +264,7 @@ no_context:
 
   out_of_memory:
 	up_read(&mm->mmap_sem);
-	printk(KERN_CRIT "VM: killing process %s\n", current->comm);
-	if (user_mode(regs))
-		do_group_exit(SIGKILL);
-	goto no_context;
+	if (!user_mode(regs))
+		goto no_context;
+	pagefault_out_of_memory();
 }
Acked-by on v1 10/14
#28 lore raw

Re: [patch 10/14] parisc: invoke oom-killer from page fault

Quoted 8 lines · On Fri, 23 Apr 2010, [email protected] wrote:

As explained in commit 1c0fe6e3bd, we want to call the architecture independent oom killer when getting an unexplained OOM from handle_mm_fault, rather than simply killing current.

#29 lore raw

Re: [patch 10/14] parisc: invoke oom-killer from page fault

Quoted 6 lines · David Rientjes
Quoted 4 lines · On Fri, 23 Apr 2010, [email protected] wrote:

As explained in commit 1c0fe6e3bd, we want to call the architecture independent oom killer when getting an unexplained OOM from handle_mm_fault, rather than simply killing current.

Quoted 6 lines
Quoted 4 lines

Thanks, applied.

#30 lore raw

PATCH 11/14 powerpc: invoke oom-killer from page fault

In reply to [email protected]

As explained in commit 1c0fe6e3bd, we want to call the architecture independent oom killer when getting an unexplained OOM from handle_mm_fault, rather than simply killing current.

---

arch/powerpc/mm/fault.c +4 -9
Index: linux-2.6/arch/powerpc/mm/fault.c
===================================================================
@@ -359,15 +359,10 @@ bad_area_nosemaphore:
  */
 out_of_memory:
 	up_read(&mm->mmap_sem);
-	if (is_global_init(current)) {
-		yield();
-		down_read(&mm->mmap_sem);
-		goto survive;
-	}
-	printk("VM: killing process %s\n", current->comm);
-	if (user_mode(regs))
-		do_group_exit(SIGKILL);
-	return SIGKILL;
+	if (!user_mode(regs))
+		return SIGKILL;
+	pagefault_out_of_memory();
+	return 0;
 
 do_sigbus:
 	up_read(&mm->mmap_sem);
#31 lore raw

Re: [patch 11/14] powerpc: invoke oom-killer from page fault

Quoted 20 lines · On Fri, 23 Apr 2010, [email protected] wrote:

As explained in commit 1c0fe6e3bd, we want to call the architecture independent oom killer when getting an unexplained OOM from handle_mm_fault, rather than simply killing current.

---
Index: linux-2.6/arch/powerpc/mm/fault.c
===================================================================

arch/powerpc/mm/fault.c +0 -3
@@ -359,15 +359,10 @@ bad_area_nosemaphore:
  */
 out_of_memory:
 	up_read(&mm->mmap_sem);
-	if (is_global_init(current)) {
-		yield();
-		down_read(&mm->mmap_sem);

arch/powerpc/mm/fault.c bad_area_nosemaphore: · line 365

Quoted 10 lines
arch/powerpc/mm/fault.c +4 -6
-		goto survive;
-	}
-	printk("VM: killing process %s\n", current->comm);
-	if (user_mode(regs))
-		do_group_exit(SIGKILL);
-	return SIGKILL;
+	if (!user_mode(regs))
+		return SIGKILL;
+	pagefault_out_of_memory();
+	return 0;

Do we really want to return 0 and indicate that the fault was handled? It seems more consistent to do

	if (user_mode(regs))
		pagefault_out_of_memory();
	return SIGKILL;
#32 lore raw

Re: [patch 11/14] powerpc: invoke oom-killer from page fault

Quoted 36 lines · David Rientjes
Quoted 20 lines · On Fri, 23 Apr 2010, [email protected] wrote:

As explained in commit 1c0fe6e3bd, we want to call the architecture independent oom killer when getting an unexplained OOM from handle_mm_fault, rather than simply killing current.

---
Index: linux-2.6/arch/powerpc/mm/fault.c
===================================================================

arch/powerpc/mm/fault.c +0 -3
@@ -359,15 +359,10 @@ bad_area_nosemaphore:
  */
 out_of_memory:
 	up_read(&mm->mmap_sem);
-	if (is_global_init(current)) {
-		yield();
-		down_read(&mm->mmap_sem);

arch/powerpc/mm/fault.c bad_area_nosemaphore: · line 365

Quoted 10 lines
arch/powerpc/mm/fault.c +4 -6
-		goto survive;
-	}
-	printk("VM: killing process %s\n", current->comm);
-	if (user_mode(regs))
-		do_group_exit(SIGKILL);
-	return SIGKILL;
+	if (!user_mode(regs))
+		return SIGKILL;
+	pagefault_out_of_memory();
+	return 0;

Do we really want to return 0 and indicate that the fault was handled? It seems more consistent to do

Quoted 3 lines
	if (user_mode(regs))
		pagefault_out_of_memory();
	return SIGKILL;

Well we don't necessarily want to kill current. pagefault_out_of_memory() could elect to send a SIGKILL if wants to, but if it decides current should not be terminated, then we have to just retry the page fault.

#33 lore raw

PATCH 12/14 score: invoke oom-killer from page fault

In reply to [email protected]

As explained in commit 1c0fe6e3bd, we want to call the architecture independent oom killer when getting an unexplained OOM from handle_mm_fault, rather than simply killing current.

---

arch/score/mm/fault.c +4 -9
Index: linux-2.6/arch/score/mm/fault.c
===================================================================
@@ -167,15 +167,10 @@ no_context:
 	*/
 out_of_memory:
 	up_read(&mm->mmap_sem);
-	if (is_global_init(tsk)) {
-		yield();
-		down_read(&mm->mmap_sem);
-		goto survive;
-	}
-	printk("VM: killing process %s\n", tsk->comm);
-	if (user_mode(regs))
-		do_group_exit(SIGKILL);
-	goto no_context;
+	if (!user_mode(regs))
+		goto no_context;
+	pagefault_out_of_memory();
+	return;
 
 do_sigbus:
 	up_read(&mm->mmap_sem);
Acked-by on v1 12/14
#34 lore raw

Re: [patch 12/14] score: invoke oom-killer from page fault

Quoted 8 lines · On Fri, 23 Apr 2010, [email protected] wrote:

As explained in commit 1c0fe6e3bd, we want to call the architecture independent oom killer when getting an unexplained OOM from handle_mm_fault, rather than simply killing current.

#35 lore raw

Re: [patch 12/14] score: invoke oom-killer from page fault

In reply to [email protected]

[email protected] 写于 2010-04-23 00:06:25:

Quoted 1 line

As explained in commit 1c0fe6e3bd, we want to call the architecture

independent

Quoted 1 line

oom killer when getting an unexplained OOM from handle_mm_fault, rather

than

Quoted 23 lines

simply killing current.

---
Index: linux-2.6/arch/score/mm/fault.c
===================================================================

arch/score/mm/fault.c +0 -6
@@ -167,15 +167,10 @@ no_context:
    */
 out_of_memory:
    up_read(&mm->mmap_sem);
-   if (is_global_init(tsk)) {
-      yield();
-      down_read(&mm->mmap_sem);
-      goto survive;
-   }
-   printk("VM: killing process %s\n", tsk->comm);

arch/score/mm/fault.c no_context: · line 176

Quoted 10 lines
arch/score/mm/fault.c +4 -3
-   if (user_mode(regs))
-      do_group_exit(SIGKILL);
-   goto no_context;
+   if (!user_mode(regs))
+      goto no_context;
+   pagefault_out_of_memory();
+   return;
 
 do_sigbus:
    up_read(&mm->mmap_sem);

Thanks, commited to score repository.

liqin

#36 lore raw

PATCH 13/14 sh: invoke oom-killer from page fault

In reply to [email protected]

As explained in commit 1c0fe6e3bd, we want to call the architecture independent oom killer when getting an unexplained OOM from handle_mm_fault, rather than simply killing current.

---

arch/sh/mm/fault_32.c +4 -9
Index: linux-2.6/arch/sh/mm/fault_32.c
===================================================================
@@ -290,15 +290,10 @@ no_context:
  */
 out_of_memory:
 	up_read(&mm->mmap_sem);
-	if (is_global_init(current)) {
-		yield();
-		down_read(&mm->mmap_sem);
-		goto survive;
-	}
-	printk("VM: killing process %s\n", tsk->comm);
-	if (user_mode(regs))
-		do_group_exit(SIGKILL);
-	goto no_context;
+	if (!user_mode(regs))
+		goto no_context;
+	pagefault_out_of_memory();
+	return;
 
 do_sigbus:
 	up_read(&mm->mmap_sem);
arch/sh/mm/tlbflush_64.c +4 -15
Index: linux-2.6/arch/sh/mm/tlbflush_64.c
===================================================================
@@ -294,22 +294,11 @@ no_context:
  * us unable to handle the page fault gracefully.
  */
 out_of_memory:
-	if (is_global_init(current)) {
-		panic("INIT out of memory\n");
-		yield();
-		goto survive;
-	}
-	printk("fault:Out of memory\n");
 	up_read(&mm->mmap_sem);
-	if (is_global_init(current)) {
-		yield();
-		down_read(&mm->mmap_sem);
-		goto survive;
-	}
-	printk("VM: killing process %s\n", tsk->comm);
-	if (user_mode(regs))
-		do_group_exit(SIGKILL);
-	goto no_context;
+	if (!user_mode(regs))
+		goto no_context;
+	pagefault_out_of_memory();
+	return;
 
 do_sigbus:
 	printk("fault:Do sigbus\n");
Acked-by on v1 13/14
#37 lore raw

Re: [patch 13/14] sh: invoke oom-killer from page fault

Quoted 8 lines · On Fri, 23 Apr 2010, [email protected] wrote:

As explained in commit 1c0fe6e3bd, we want to call the architecture independent oom killer when getting an unexplained OOM from handle_mm_fault, rather than simply killing current.

#38 lore raw

Re: [patch 13/14] sh: invoke oom-killer from page fault

In reply to [email protected]
Quoted 8 lines · On Fri, Apr 23, 2010 at 02:06:26AM +1000, [email protected] wrote:

As explained in commit 1c0fe6e3bd, we want to call the architecture independent oom killer when getting an unexplained OOM from handle_mm_fault, rather than simply killing current.

Applied with David's Acked-by, thanks.

#39 lore raw

PATCH 14/14 xtensa: invoke oom-killer from page fault

In reply to [email protected]

As explained in commit 1c0fe6e3bd, we want to call the architecture independent oom killer when getting an unexplained OOM from handle_mm_fault, rather than simply killing current.

---

arch/xtensa/mm/fault.c +4 -9
Index: linux-2.6/arch/xtensa/mm/fault.c
===================================================================
@@ -146,15 +146,10 @@ bad_area:
 	 */
 out_of_memory:
 	up_read(&mm->mmap_sem);
-	if (is_global_init(current)) {
-		yield();
-		down_read(&mm->mmap_sem);
-		goto survive;
-	}
-	printk("VM: killing process %s\n", current->comm);
-	if (user_mode(regs))
-		do_group_exit(SIGKILL);
-	bad_page_fault(regs, address, SIGKILL);
+	if (!user_mode(regs))
+		bad_page_fault(regs, address, SIGKILL);
+	else
+		pagefault_out_of_memory();
 	return;
 
 do_sigbus:
Acked-by on v1 14/14
#40 lore raw

Re: [patch 14/14] xtensa: invoke oom-killer from page fault

Quoted 7 lines · On Fri, 23 Apr 2010, [email protected] wrote:

As explained in commit 1c0fe6e3bd, we want to call the architecture independent oom killer when getting an unexplained OOM from handle_mm_fault, rather than simply killing current.