Date: Sat, 20 Jun 2009 17:57:59 GMT From: Edward Tomasz Napierala <trasz@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 164771 for review Message-ID: <200906201757.n5KHvxam046369@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=164771 Change 164771 by trasz@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) ====
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200906201757.n5KHvxam046369>