rpms/kernel/devel linux-2.6-debug-vm-would-have-oomkilled.patch, NONE, 1.1 kernel.spec, 1.558, 1.559

Dave Jones (davej) fedora-extras-commits at redhat.com
Sat Mar 29 19:04:02 UTC 2008


Author: davej

Update of /cvs/pkgs/rpms/kernel/devel
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv21674

Modified Files:
	kernel.spec 
Added Files:
	linux-2.6-debug-vm-would-have-oomkilled.patch 
Log Message:
Add a 'would have oomkilled' sysctl for debugging.

linux-2.6-debug-vm-would-have-oomkilled.patch:

--- NEW FILE linux-2.6-debug-vm-would-have-oomkilled.patch ---
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index b2a2d68..3b132ee 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -67,6 +67,7 @@ extern int sysctl_overcommit_ratio;
 extern int sysctl_panic_on_oom;
 extern int sysctl_oom_kill_allocating_task;
 extern int sysctl_oom_dump_tasks;
+extern int sysctl_would_have_oomkilled;
 extern int max_threads;
 extern int core_uses_pid;
 extern int suid_dumpable;
@@ -861,6 +862,14 @@ static struct ctl_table vm_table[] = {
 		.proc_handler	= &proc_dointvec,
 	},
 	{
+		.ctl_name	= CTL_UNNUMBERED,
+		.procname	= "would_have_oomkilled",
+		.data		= &sysctl_would_have_oomkilled,
+		.maxlen		= sizeof(sysctl_would_have_oomkilled),
+		.mode		= 0644,
+		.proc_handler	= &proc_dointvec,
+	},
+	{
 		.ctl_name	= VM_OVERCOMMIT_RATIO,
 		.procname	= "overcommit_ratio",
 		.data		= &sysctl_overcommit_ratio,
diff --git a/mm/oom_kill.c b/mm/oom_kill.c
index f255eda..3335a94 100644
--- a/mm/oom_kill.c
+++ b/mm/oom_kill.c
@@ -30,6 +30,7 @@
 int sysctl_panic_on_oom;
 int sysctl_oom_kill_allocating_task;
 int sysctl_oom_dump_tasks;
+int sysctl_would_have_oomkilled;
 static DEFINE_SPINLOCK(zone_scan_mutex);
 /* #define DEBUG */
 
@@ -321,6 +322,12 @@ static void __oom_kill_task(struct task_struct *p, int verbose)
 		return;
 	}
 
+	if (sysctl_would_have_oomkilled == 1) {
+		printk(KERN_ERR "Would have killed process %d (%s). But continuing instead.\n",
+				task_pid_nr(p), p->comm);
+		return;
+	}
+
 	if (verbose)
 		printk(KERN_ERR "Killed process %d (%s)\n",
 				task_pid_nr(p), p->comm);
@@ -363,6 +370,12 @@ static int oom_kill_task(struct task_struct *p)
 			return 1;
 	} while_each_thread(g, q);
 
+	if (sysctl_would_have_oomkilled == 1) {
+		printk(KERN_ERR "Would have killed process %d (%s). But continuing instead.\n",
+				task_pid_nr(p), p->comm);
+		return 1;
+	}
+
 	__oom_kill_task(p, 1);
 
 	/*


Index: kernel.spec
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/devel/kernel.spec,v
retrieving revision 1.558
retrieving revision 1.559
diff -u -r1.558 -r1.559
--- kernel.spec	29 Mar 2008 18:56:24 -0000	1.558
+++ kernel.spec	29 Mar 2008 19:03:01 -0000	1.559
@@ -589,6 +589,7 @@
 Patch270: linux-2.6-debug-taint-vm.patch
 Patch280: linux-2.6-debug-spinlock-taint.patch
 Patch330: linux-2.6-debug-no-quiet.patch
+Patch340: linux-2.6-debug-vm-would-have-oomkilled.patch
 Patch350: linux-2.6-devmem.patch
 Patch370: linux-2.6-crash-driver.patch
 Patch400: linux-2.6-scsi-cpqarray-set-master.patch
@@ -1045,6 +1046,7 @@
 %if !%{debugbuildsenabled}
 ApplyPatch linux-2.6-debug-no-quiet.patch
 %endif
+ApplyPatch linux-2.6-debug-vm-would-have-oomkilled.patch
 
 #
 # Make /dev/mem a need-to-know function
@@ -1733,6 +1735,9 @@
 %kernel_variant_files -a /%{image_install_path}/xen*-%{KVERREL} -e /etc/ld.so.conf.d/kernelcap-%{KVERREL}.conf %{with_xen} xen
 
 %changelog
+* Sat Mar 29 2008 Dave Jones <davej at redhat.com>
+- Add a 'would have oomkilled' sysctl for debugging.
+
 * Sat Mar 29 2008 Jarod Wilson <jwilson at redhat.com>
 - Add new virtual Provides to go with the new uname scheme to
   make life easier for 3rd-party kernel module packaging.




More information about the fedora-extras-commits mailing list