From owner-svn-soc-all@FreeBSD.ORG Wed Sep 5 18:09:21 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 52F781065670 for ; Wed, 5 Sep 2012 18:09:19 +0000 (UTC) (envelope-from rudot@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Wed, 05 Sep 2012 18:09:19 +0000 Date: Wed, 05 Sep 2012 18:09:19 +0000 From: rudot@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120905180919.52F781065670@hub.freebsd.org> Cc: Subject: socsvn commit: r241312 - soc2012/rudot/sys/kern X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Sep 2012 18:09:21 -0000 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 #include #include +#include #include #include #include @@ -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;