Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 11 Oct 2009 15:48:36 GMT
From:      Edward Tomasz Napierala <trasz@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 169399 for review
Message-ID:  <200910111548.n9BFmapx041474@repoman.freebsd.org>

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

Change 169399 by trasz@trasz_victim on 2009/10/11 15:48:10

	Move two routines; no functional changes.

Affected files ...

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

Differences ...

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

@@ -114,57 +114,6 @@
 
 MALLOC_DEFINE(M_HRL, "hrl", "Hierarchical Resource Limits");
 
-#ifdef DIAGNOSTIC
-/*
- * Go through the resource usage info and verify that it makes sense.
- */
-static void
-hrl_assert_proc(const struct proc *p __unused)
-{
-	int resource;
-	struct ucred *cred;
-	struct prison *pr;
-	
-	cred = p->p_ucred;
-	mtx_assert(&hrl_lock, MA_OWNED);
-	for (resource = 0; resource <= HRL_RESOURCE_MAX; resource++)
-		KASSERT(p->p_container.hc_resources[resource] >= 0,
-		    ("resource usage propagation meltdown"));
-	KASSERT(cred->cr_ruidinfo->ui_container.hc_resources[resource] >= 0,
-	    ("resource usage propagation meltdown"));
-	KASSERT(cred->cr_ruidinfo->ui_container.hc_resources[resource] >=
-	    p->p_container.hc_resources[resource],
-	    ("resource usage propagation meltdown"));
-	for (pr = cred->cr_prison; pr != NULL; pr = pr->pr_parent) {
-		KASSERT(pr->pr_container.hc_resources[resource] >= 0,
-		    ("resource usage propagation meltdown"));
-		KASSERT(pr->pr_container.hc_resources[resource] >=
-	    	    p->p_container.hc_resources[resource],
-		    ("resource usage propagation meltdown"));
-	}
-}
-#endif /* DIAGNOSTIC */
-
-void
-hrl_proc_exiting(struct proc *p)
-{
-	int i;
-
-	/*
-	 * XXX: Free these three some other way.
-	 */
-	hrl_allocated(p, HRL_RESOURCE_FILESIZE, 0);
-	hrl_allocated(p, HRL_RESOURCE_COREDUMPSIZE, 0);
-	hrl_allocated(p, HRL_RESOURCE_PTY, 0);
-
-	mtx_lock(&hrl_lock);
-	for (i = 0; i <= HRL_RESOURCE_MAX; i++) {
-		KASSERT(p->p_container.hc_resources[i] == 0,
-			    ("dead process still holding resources"));
-	}
-	mtx_unlock(&hrl_lock);
-}
-
 static int
 hrl_resource_inheritable(int resource)
 {
@@ -437,7 +386,38 @@
 	}
 }
 
+#ifdef DIAGNOSTIC
+/*
+ * Go through the resource usage info and verify that it makes sense.
+ */
 static void
+hrl_assert_proc(const struct proc *p __unused)
+{
+	int resource;
+	struct ucred *cred;
+	struct prison *pr;
+	
+	cred = p->p_ucred;
+	mtx_assert(&hrl_lock, MA_OWNED);
+	for (resource = 0; resource <= HRL_RESOURCE_MAX; resource++)
+		KASSERT(p->p_container.hc_resources[resource] >= 0,
+		    ("resource usage propagation meltdown"));
+	KASSERT(cred->cr_ruidinfo->ui_container.hc_resources[resource] >= 0,
+	    ("resource usage propagation meltdown"));
+	KASSERT(cred->cr_ruidinfo->ui_container.hc_resources[resource] >=
+	    p->p_container.hc_resources[resource],
+	    ("resource usage propagation meltdown"));
+	for (pr = cred->cr_prison; pr != NULL; pr = pr->pr_parent) {
+		KASSERT(pr->pr_container.hc_resources[resource] >= 0,
+		    ("resource usage propagation meltdown"));
+		KASSERT(pr->pr_container.hc_resources[resource] >=
+	    	    p->p_container.hc_resources[resource],
+		    ("resource usage propagation meltdown"));
+	}
+}
+#endif /* DIAGNOSTIC */
+
+static void
 hrl_container_add(struct hrl_container *dest, const struct hrl_container *src)
 {
 	int i;
@@ -1847,6 +1827,26 @@
 	PROC_UNLOCK(parent);
 }
 
+void
+hrl_proc_exiting(struct proc *p)
+{
+	int i;
+
+	/*
+	 * XXX: Free these three some other way.
+	 */
+	hrl_allocated(p, HRL_RESOURCE_FILESIZE, 0);
+	hrl_allocated(p, HRL_RESOURCE_COREDUMPSIZE, 0);
+	hrl_allocated(p, HRL_RESOURCE_PTY, 0);
+
+	mtx_lock(&hrl_lock);
+	for (i = 0; i <= HRL_RESOURCE_MAX; i++) {
+		KASSERT(p->p_container.hc_resources[i] == 0,
+			    ("dead process still holding resources"));
+	}
+	mtx_unlock(&hrl_lock);
+}
+
 /*
  * Go through the process' limits, freeing them.
  */



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