Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 7 Jul 2009 17:48:58 GMT
From:      Edward Tomasz Napierala <trasz@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 165762 for review
Message-ID:  <200907071748.n67HmwCe089017@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=165762

Change 165762 by trasz@trasz_victim on 2009/07/07 17:48:09

	Add some more debugging stuff, fix a KASSERT.

Affected files ...

.. //depot/projects/soc2009/trasz_limits/sys/kern/kern_hrl.c#26 edit

Differences ...

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

@@ -53,6 +53,7 @@
 #define	HRF_DONT_ACCUMULATE	2
 
 int hrl_group_accounting = 0;
+
 TUNABLE_INT("kern.hrl_group_accounting", &hrl_group_accounting);
 SYSCTL_INT(_kern, OID_AUTO, hrl_group_accounting, CTLFLAG_RD, &hrl_group_accounting, 0, "");
 
@@ -199,11 +200,11 @@
 	 */
 	hrl_allocated_proc(p, HRL_RESOURCE_FILESIZE, 0);
 	hrl_allocated_proc(p, HRL_RESOURCE_COREDUMPSIZE, 0);
+	hrl_allocated_proc(p, HRL_RESOURCE_PTY, 0);
 
 	mtx_lock(&hrl_lock);
 	for (i = 0; i < HRL_RESOURCE_MAX; i++) {
-		if (p->p_usage.hu_resources[i] != 0)
-			KASSERT(p->p_usage.hu_resources == 0,
+		KASSERT(p->p_usage.hu_resources[i] == 0,
 			    ("dead process still holding resources"));
 	}
 	mtx_unlock(&hrl_lock);
@@ -287,6 +288,10 @@
 	KASSERT(amount > 0, ("hrl_alloc_proc: invalid amount for %s: %lld",
 	    hrl_resource_name(resource), amount));
 
+#if 0
+	printf("hrl_alloc_proc: allocating %lld of %s for %s (pid %d)\n", amount, hrl_resource_name(resource), p->p_comm, p->p_pid);
+#endif
+
 	mtx_lock(&hrl_lock);
 	p->p_usage.hu_resources[resource] += amount;
 	cred = p->p_ucred;
@@ -347,6 +352,10 @@
 	KASSERT(amount >= 0, ("hrl_allocated_proc: invalid amount for %s: %lld",
 	    hrl_resource_name(resource), amount));
 
+#if 0
+	printf("hrl_allocated_proc: allocated %lld of %s for %s (pid %d)\n", amount, hrl_resource_name(resource), p->p_comm, p->p_pid);
+#endif
+
 	mtx_lock(&hrl_lock);
 	diff = amount - p->p_usage.hu_resources[resource];
 	p->p_usage.hu_resources[resource] = amount;
@@ -395,14 +404,16 @@
 	KASSERT(amount > 0, ("hrl_free_proc: invalid amount for %s: %lld",
 	    hrl_resource_name(resource), amount));
 
+#if 0
+	printf("hrl_free_proc: freeing %lld of %s for %s (pid %d)\n", amount, hrl_resource_name(resource), p->p_comm, p->p_pid);
+#endif
+
 	mtx_lock(&hrl_lock);
+	KASSERT(amount <= p->p_usage.hu_resources[resource],
+	    ("hrl_free_proc: freeing %lld of %s, which is more than allocated %lld "
+	    "for %s (pid %d)", amount, hrl_resource_name(resource), p->p_usage.hu_resources[resource],
+	    p->p_comm, p->p_pid));
 	p->p_usage.hu_resources[resource] -= amount;
-#ifdef notyet
-	KASSERT(amount <= p->p_usage.hu_resources[resource],
-	    ("hrl_free_proc: freeing %lld, which is more than allocated %lld "
-	    "for %s", amount, p->p_usage.hu_resources[resource],
-	    hrl_resource_name(resource)));
-#endif
 	cred = p->p_ucred;
 	cred->cr_ruidinfo->ui_usage.hu_resources[resource] -= amount;
 	if (cred->cr_ruidinfo != cred->cr_uidinfo)



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