Date: Thu, 24 May 2012 16:36:54 +0000 From: rudot@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r236300 - in soc2012/rudot: aux sys/kern Message-ID: <20120524163654.B3A17106564A@hub.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: rudot Date: Thu May 24 16:36:54 2012 New Revision: 236300 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=236300 Log: the 4bsd scheduler sets the RACCT_PCTCPU resource value, it is not finished yet. Modified: soc2012/rudot/aux/notes.txt soc2012/rudot/sys/kern/kern_racct.c soc2012/rudot/sys/kern/sched_4bsd.c Modified: soc2012/rudot/aux/notes.txt ============================================================================== --- soc2012/rudot/aux/notes.txt Thu May 24 16:23:21 2012 (r236299) +++ soc2012/rudot/aux/notes.txt Thu May 24 16:36:54 2012 (r236300) @@ -1 +1,4 @@ rctl -a process:PID:pcpu:deny=50 works + +sched_4bsd sets the RACCT_PCTCPU resource to the td->ts_pctcpu value in the +schedcpu routine. I will move it probably to the sched_clock. Modified: soc2012/rudot/sys/kern/kern_racct.c ============================================================================== --- soc2012/rudot/sys/kern/kern_racct.c Thu May 24 16:23:21 2012 (r236299) +++ soc2012/rudot/sys/kern/kern_racct.c Thu May 24 16:36:54 2012 (r236300) @@ -140,7 +140,8 @@ [RACCT_SHMSIZE] = RACCT_RECLAIMABLE | RACCT_DENIABLE | RACCT_SLOPPY, [RACCT_WALLCLOCK] = - RACCT_IN_MILLIONS }; + RACCT_IN_MILLIONS, + [RACCT_PCTCPU] = RACCT_RECLAIMABLE | RACCT_DENIABLE }; static void racct_add_racct(struct racct *dest, const struct racct *src) Modified: soc2012/rudot/sys/kern/sched_4bsd.c ============================================================================== --- soc2012/rudot/sys/kern/sched_4bsd.c Thu May 24 16:23:21 2012 (r236299) +++ soc2012/rudot/sys/kern/sched_4bsd.c Thu May 24 16:36:54 2012 (r236300) @@ -68,6 +68,10 @@ dtrace_vtime_switch_func_t dtrace_vtime_switch_func; #endif +#ifdef RACCT +#include <sys/racct.h> +#endif + /* * INVERSE_ESTCPU_WEIGHT is only suitable for statclock() frequencies in * the range 100-256 Hz (approximately). @@ -507,6 +511,9 @@ #endif ts->ts_cpticks = 0; } +#ifdef RACCT + racct_set(p, RACCT_PCTCPU, ts->ts_pctcpu); +#endif /* * If there are ANY running threads in this process, * then don't count it as sleeping. @@ -670,6 +677,18 @@ return (sched_quantum); } +#ifdef RACCT +static int +sched_racct_pcpu_deny(struct thread *td) +{ + struct proc *p; + + p = td->td_proc; + + return (0); +} +#endif + /* * We adjust the priority of the current process. The priority of * a process gets worse as it accumulates CPU time. The cpu usage @@ -708,6 +727,12 @@ ticks - PCPU_GET(switchticks) >= sched_quantum) td->td_flags |= TDF_NEEDRESCHED; +#ifdef RACCT + if (!TD_IS_IDLETHREAD(td) && + sched_racct_pcpu_deny(td)) + td->td_flags |= TDF_NEEDRESCHED; +#endif + stat = DPCPU_PTR(idlestat); stat->oldidlecalls = stat->idlecalls; stat->idlecalls = 0;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20120524163654.B3A17106564A>