PERFORCE change 182022 for review

Edward Tomasz Napierala trasz at FreeBSD.org
Sat Aug 7 12:49:22 UTC 2010


http://p4web.freebsd.org/@@182022?ac=10

Change 182022 by trasz at 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);


More information about the p4-projects mailing list