patch-2.4.19 linux-2.4.19/arch/m68k/mm/fault.c

Next file: linux-2.4.19/arch/m68k/mm/memory.c
Previous file: linux-2.4.19/arch/m68k/math-emu/multi_arith.h
Back to the patch index
Back to the overall index

diff -urN linux-2.4.18/arch/m68k/mm/fault.c linux-2.4.19/arch/m68k/mm/fault.c
@@ -152,22 +152,25 @@
 	 * make sure we exit gracefully rather than endlessly redo
 	 * the fault.
 	 */
+
+ survive:
 	fault = handle_mm_fault(mm, vma, address, write);
 #ifdef DEBUG
  	printk("handle_mm_fault returns %d\n",fault);
 #endif
-	if (fault < 0)
-		goto out_of_memory;
-	if (!fault)
+	switch (fault) {
+	case 1:
+		current->min_flt++;
+		break;
+	case 2:
+		current->maj_flt++;
+		break;
+	case 0:
 		goto bus_err;
+	default:
+		goto out_of_memory;
+	}
 
-	/* There seems to be a missing invalidate somewhere in do_no_page.
-	 * Until I found it, this one cures the problem and makes
-	 * 1.2 run on the 68040 (Martin Apel).
-	 */
-	#warning should be obsolete now...
-	if (CPU_IS_040_OR_060)
-		flush_tlb_page(vma, address);
 	up_read(&mm->mmap_sem);
 	return 0;
 
@@ -176,6 +179,14 @@
  * us unable to handle the page fault gracefully.
  */
 out_of_memory:
+	up_read(&mm->mmap_sem);
+	if (current->pid == 1) {
+		current->policy |= SCHED_YIELD;
+		schedule();
+		down_read(&mm->mmap_sem);
+		goto survive;
+	}
+	
 	printk("VM: killing process %s\n", current->comm);
 	if (user_mode(regs))
 		do_exit(SIGKILL);

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)