PERFORCE change 164771 for review

Edward Tomasz Napierala trasz at FreeBSD.org
Sat Jun 20 17:58:01 UTC 2009


http://perforce.freebsd.org/chv.cgi?CH=164771

Change 164771 by trasz at trasz_victim on 2009/06/20 17:57:16

	Misc. tweaks for asserts; still commented out.

Affected files ...

.. //depot/projects/soc2009/trasz_limits/sys/kern/kern_hrl.c#13 edit
.. //depot/projects/soc2009/trasz_limits/sys/kern/kern_prot.c#11 edit

Differences ...

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

@@ -116,13 +116,13 @@
 	cred = p->p_ucred;
 
 	for (resource = 0; resource < HRL_RESOURCE_MAX; resource++)
-		KASSERT(p->p_accounting.ha_resources[resource] >= 0, (""));
-	KASSERT(cred->cr_ruidinfo->ui_accounting.ha_resources[resource] >= 0, (""));
+		KASSERT(p->p_accounting.ha_resources[resource] >= 0, ("resource usage propagation meltdown"));
+	KASSERT(cred->cr_ruidinfo->ui_accounting.ha_resources[resource] >= 0, ("resource usage propagation meltdown"));
 	for (pr = cred->cr_prison; pr != NULL; pr = pr->pr_parent)
-		KASSERT(pr->pr_accounting.ha_resources[resource] >= 0, (""));
+		KASSERT(pr->pr_accounting.ha_resources[resource] >= 0, ("resource usage propagation meltdown"));
 	for (i = 0; i < cred->cr_ngroups; i++) {
 		for (resource = 0; resource < HRL_RESOURCE_MAX; resource++)
-			KASSERT(cred->cr_gidinfos[i]->gi_accounting.ha_resources[resource] >= 0, (""));
+			KASSERT(cred->cr_gidinfos[i]->gi_accounting.ha_resources[resource] >= 0, ("resource usage propagation meltdown"));
 	}
 #endif
 }
@@ -209,6 +209,9 @@
 	KASSERT(amount > 0, ("invalid amount"));
 
 	p->p_accounting.ha_resources[resource] -= amount;
+#ifdef notyet
+	KASSERT(amount >= p->p_accounting.ha_resources[resource], ("freeing more than allocated"));
+#endif
 	cred = p->p_ucred;
 	cred->cr_ruidinfo->ui_accounting.ha_resources[resource] -= amount;
 	cred->cr_uidinfo->ui_accounting.ha_resources[resource] -= amount;
@@ -290,10 +293,13 @@
 	int i;
 
 	for (i = 0; i < HRL_RESOURCE_MAX; i++) {
-			dest->ha_resources[i] += src->ha_resources[i];
+#ifdef notyet
+		KASSERT(dest->ha_resources[i] >= 0, ("resource usage propagation meltdown"));
+#endif
+		dest->ha_resources[i] += src->ha_resources[i];
 #ifdef notyet
-			KASSERT(src->ha_resources[i] >= 0, (""));
-			KASSERT(dest->ha_resources[i] >= 0, (""));
+		KASSERT(src->ha_resources[i] >= 0, ("resource usage propagation meltdown"));
+		KASSERT(dest->ha_resources[i] >= 0, ("resource usage propagation meltdown"));
 #endif
 	}
 }
@@ -304,10 +310,13 @@
 	int i;
 
 	for (i = 0; i < HRL_RESOURCE_MAX; i++) {
-			dest->ha_resources[i] -= src->ha_resources[i];
+#ifdef notyet
+		KASSERT(dest->ha_resources[i] >= 0, ("resource usage propagation meltdown"));
+#endif
+		dest->ha_resources[i] -= src->ha_resources[i];
 #ifdef notyet
-			KASSERT(src->ha_resources[i] >= 0, (""));
-			KASSERT(dest->ha_resources[i] >= 0, (""));
+		KASSERT(src->ha_resources[i] >= 0, ("resource usage propagation meltdown"));
+		KASSERT(dest->ha_resources[i] >= 0, ("resource usage propagation meltdown"));
 #endif
 	}
 }

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



More information about the p4-projects mailing list