socsvn commit: r240292 - soc2012/rudot/sys/kern
rudot at FreeBSD.org
rudot at FreeBSD.org
Sun Aug 12 08:54:22 UTC 2012
Author: rudot
Date: Sun Aug 12 08:54:19 2012
New Revision: 240292
URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=240292
Log:
decaying pcpu - complete
Modified:
soc2012/rudot/sys/kern/kern_racct.c
Modified: soc2012/rudot/sys/kern/kern_racct.c
==============================================================================
--- soc2012/rudot/sys/kern/kern_racct.c Sun Aug 12 07:09:25 2012 (r240291)
+++ soc2012/rudot/sys/kern/kern_racct.c Sun Aug 12 08:54:19 2012 (r240292)
@@ -308,9 +308,9 @@
fixpt_t p_pctcpu;
struct thread *td;
- swtime = (ticks - p->p_swtick) / hz;
- if ((swtime == 0) || ((p->p_flag & P_INMEM) == 0))
+ if ((p->p_flag & P_INMEM) == 0)
return (0);
+ swtime = (ticks - p->p_swtick) / hz;
if (swtime < RACCT_PCPU_SECS) {
/*
* For short-lived processes, the sched_pctcpu() returns small
@@ -479,6 +479,12 @@
("racct_alloc_resource: usage < 0"));
racct->r_resources[resource] = 0;
}
+
+ if (resource == RACCT_PCTCPU) {
+ if (racct->r_resources[RACCT_PCTCPU] > 100) {
+ racct->r_resources[RACCT_PCTCPU] = 100;
+ }
+ }
}
static int
@@ -608,16 +614,16 @@
}
available = INT64_MAX;
-#ifdef RCTL
- available = rctl_pcpu_available(p);
-#endif
racct_alloc_resource(p->p_racct, resource, diff_proc);
if (diff_cred > 0)
racct_add_cred_locked(p->p_ucred, resource, diff_cred);
else if (diff_cred < 0)
racct_sub_cred_locked(p->p_ucred, resource, -diff_cred);
- return (available <= diff_proc);
+#ifdef RCTL
+ available = rctl_pcpu_available(p);
+#endif
+ return (available <= 0);
}
static int
More information about the svn-soc-all
mailing list