Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 15 Nov 2012 14:11:34 +0000 (UTC)
From:      Edward Tomasz Napierala <trasz@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r243070 - head/sys/kern
Message-ID:  <201211151411.qAFEBYh9095545@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: trasz
Date: Thu Nov 15 14:11:34 2012
New Revision: 243070
URL: http://svnweb.freebsd.org/changeset/base/243070

Log:
  Fix kassert that's not really valid for %CPU accounting.  The problem
  here is race between decaying the resource usage in containers, and updating
  per-process usage; basically, the former may cause per-container usage
  to get smaller than per-process usage.
  
  Submitted by:	Rudo Tomori

Modified:
  head/sys/kern/kern_racct.c

Modified: head/sys/kern/kern_racct.c
==============================================================================
--- head/sys/kern/kern_racct.c	Thu Nov 15 14:10:51 2012	(r243069)
+++ head/sys/kern/kern_racct.c	Thu Nov 15 14:11:34 2012	(r243070)
@@ -403,7 +403,7 @@ racct_sub_racct(struct racct *dest, cons
 	 * Update resource usage in dest.
 	 */
 	for (i = 0; i <= RACCT_MAX; i++) {
-		if (!RACCT_IS_SLOPPY(i)) {
+		if (!RACCT_IS_SLOPPY(i) && !RACCT_IS_DECAYING(i)) {
 			KASSERT(dest->r_resources[i] >= 0,
 			    ("racct propagation meltdown: dest < 0"));
 			KASSERT(src->r_resources[i] >= 0,
@@ -414,7 +414,8 @@ racct_sub_racct(struct racct *dest, cons
 		if (RACCT_CAN_DROP(i)) {
 			dest->r_resources[i] -= src->r_resources[i];
 			if (dest->r_resources[i] < 0) {
-				KASSERT(RACCT_IS_SLOPPY(i),
+				KASSERT(RACCT_IS_SLOPPY(i) ||
+				    RACCT_IS_DECAYING(i),
 				    ("racct_sub_racct: usage < 0"));
 				dest->r_resources[i] = 0;
 			}



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