Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 05 Sep 2012 18:09:19 +0000
From:      rudot@FreeBSD.org
To:        svn-soc-all@FreeBSD.org
Subject:   socsvn commit: r241312 - soc2012/rudot/sys/kern
Message-ID:  <20120905180919.52F781065670@hub.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: rudot
Date: Wed Sep  5 18:09:19 2012
New Revision: 241312
URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=241312

Log:
  change RACCT_PCPU_IGNORE into sysctl

Modified:
  soc2012/rudot/sys/kern/kern_racct.c

Modified: soc2012/rudot/sys/kern/kern_racct.c
==============================================================================
--- soc2012/rudot/sys/kern/kern_racct.c	Wed Sep  5 17:13:08 2012	(r241311)
+++ soc2012/rudot/sys/kern/kern_racct.c	Wed Sep  5 18:09:19 2012	(r241312)
@@ -53,6 +53,7 @@
 #include <sys/sdt.h>
 #include <sys/smp.h>
 #include <sys/sx.h>
+#include <sys/sysctl.h>
 #include <sys/sysent.h>
 #include <sys/sysproto.h>
 #include <sys/umtx.h>
@@ -67,9 +68,13 @@
 FEATURE(racct, "Resource Accounting");
 
 /*
- * Do not block processes that have their %cpu usage <= RACCT_PCTCPU_IGNORE
+ * Do not block processes that have their %cpu usage <= pcpu_threshold
  */
-#define	RACCT_PCTCPU_IGNORE	1
+static int pcpu_threshold = 1;
+
+SYSCTL_NODE(_kern, OID_AUTO, racct, CTLFLAG_RW, 0, "Resource Accounting");
+SYSCTL_UINT(_kern_racct, OID_AUTO, pcpu_threshold, CTLFLAG_RW, &pcpu_threshold,
+    0, "Processes with higher %cpu usage than this value can be throttled.");
 
 /*
  * How many seconds it takes to use the scheduler %cpu calculations. When a
@@ -1005,7 +1010,9 @@
 racct_proc_disable(struct proc *p)
 {
 	struct thread *td;
+#ifdef SMP
 	int cpuid;
+#endif
 
 	PROC_LOCK_ASSERT(p, MA_OWNED);
 	mtx_assert(&racct_lock, MA_OWNED);
@@ -1015,7 +1022,7 @@
 	 * low %cpu utilization to improve interactivity.
 	 */
 	if (((p->p_flag & (P_SYSTEM | P_KTHREAD)) != 0) ||
-	    (p->p_racct->r_resources[RACCT_PCTCPU] <= RACCT_PCTCPU_IGNORE))
+	    (p->p_racct->r_resources[RACCT_PCTCPU] <= pcpu_threshold))
 		return;
 	p->p_racct->r_pflags |= R_PCPUEXCEEDED;
 



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