Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 7 Aug 2010 12:49:21 GMT
From:      Edward Tomasz Napierala <trasz@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 182022 for review
Message-ID:  <201008071249.o77CnLNf092051@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://p4web.freebsd.org/@@182022?ac=10

Change 182022 by trasz@trasz_victim on 2010/08/07 12:49:01

	Turn destroying a non-empty container (container for which any counter
	for reclaimable resource is > 0) into an error.

Affected files ...

.. //depot/projects/soc2009/trasz_limits/sys/kern/kern_container.c#25 edit

Differences ...

==== //depot/projects/soc2009/trasz_limits/sys/kern/kern_container.c#25 (text+ko) ====

@@ -236,22 +236,6 @@
 	mtx_unlock(&container_lock);
 }
 
-static void
-container_leave_parents(struct container *child)
-{
-	int i;
-
-	mtx_assert(&container_lock, MA_OWNED);
-	KASSERT(child != NULL, ("child != NULL"));
-
-	for (i = 0; i <= CONTAINER_PARENTS_MAX; i++) {
-		if (child->c_parents[i] == NULL)
-			continue;
-		container_sub(child->c_parents[i], child);
-		child->c_parents[i] = NULL;
-	}
-}
-
 void
 container_create(struct container *container)
 {
@@ -278,15 +262,15 @@
 	KASSERT(container != NULL, ("NULL container"));
 
 	for (i = 0; i <= RUSAGE_MAX; i++) {
-		if (container->c_resources[i] != 0 &&
-		    container_resource_reclaimable(i))
-			printf("destroying non-empty container: "
-			    "%ju allocated for resource %d",
-			    container->c_resources[i], i);
-		container->c_resources[i] = 0;
+		KASSERT(container->c_resources[i] == 0 ||
+		    !container_resource_reclaimable(i),
+		    ("destroying non-empty container: "
+		    "%ju allocated for resource %d\n",
+		    container->c_resources[i], i));
 	}
 
-	container_leave_parents(container);
+	for (i = 0; i <= CONTAINER_PARENTS_MAX; i++)
+		container->c_parents[i] = NULL;
 }
 
 void
@@ -564,6 +548,7 @@
 	 * XXX: Free this some other way.
 	 */
 	rusage_set(p, RUSAGE_FSIZE, 0);
+	rusage_set(p, RUSAGE_NPTS, 0);
 
 #ifdef HRL
 	hrl_proc_exit(p);



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