Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 10 Feb 2020 18:06:39 +0000 (UTC)
From:      "Jonathan T. Looney" <jtl@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r357742 - head/sys/vm
Message-ID:  <202002101806.01AI6dru090911@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jtl
Date: Mon Feb 10 18:06:38 2020
New Revision: 357742
URL: https://svnweb.freebsd.org/changeset/base/357742

Log:
  Modify the vm.panic_on_oom sysctl to take a count of events.
  
  Currently, the vm.panic_on_oom sysctl is a boolean which controls the
  behavior of the VM system when it encounters an out-of-memory situation.
  If set to 0, the VM system kills the largest process. If set to any other
  value, the VM system will initiate a panic.
  
  This change makes the sysctl a count of events. If set to 0, the VM system
  kills the largest process. If set to any other value, the VM system will
  kill the largest process until it has seen the specified number of
  out-of-memory events. Once it reaches the specified number of events, it
  will initiate a panic.
  
  This change is helpful in capturing cores when the system is in a perpetual
  cycle of out-of-memory events (as opposed to just hitting one or two
  sporadic out-of-memory events).
  
  Reviewed by:	kib
  MFC after:	2 weeks
  Sponsored by:	Netflix
  Differential Revision:	https://reviews.freebsd.org/D23601

Modified:
  head/sys/vm/vm_pageout.c

Modified: head/sys/vm/vm_pageout.c
==============================================================================
--- head/sys/vm/vm_pageout.c	Mon Feb 10 17:17:08 2020	(r357741)
+++ head/sys/vm/vm_pageout.c	Mon Feb 10 18:06:38 2020	(r357742)
@@ -158,7 +158,7 @@ static int vm_panic_on_oom = 0;
 
 SYSCTL_INT(_vm, OID_AUTO, panic_on_oom,
 	CTLFLAG_RWTUN, &vm_panic_on_oom, 0,
-	"panic on out of memory instead of killing the largest process");
+	"Panic on the given number of out-of-memory errors instead of killing the largest process");
 
 SYSCTL_INT(_vm, OID_AUTO, pageout_update_period,
 	CTLFLAG_RWTUN, &vm_pageout_update_period, 0,
@@ -1933,7 +1933,7 @@ vm_pageout_oom(int shortage)
 	}
 	sx_sunlock(&allproc_lock);
 	if (bigproc != NULL) {
-		if (vm_panic_on_oom != 0)
+		if (vm_panic_on_oom != 0 && --vm_panic_on_oom == 0)
 			panic("out of swap space");
 		PROC_LOCK(bigproc);
 		killproc(bigproc, "out of swap space");



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202002101806.01AI6dru090911>