PERFORCE change 188039 for review
Edward Tomasz Napierala
trasz at FreeBSD.org
Fri Jan 21 18:50:09 UTC 2011
http://p4web.freebsd.org/@@188039?ac=10
Change 188039 by trasz at trasz_victim on 2011/01/21 18:49:42
We need proc lock to use FOREACH_THREAD_IN_PROC().
Affected files ...
.. //depot/projects/soc2009/trasz_limits/sys/kern/kern_container.c#58 edit
Differences ...
==== //depot/projects/soc2009/trasz_limits/sys/kern/kern_container.c#58 (text+ko) ====
@@ -712,6 +712,8 @@
u_char newpri;
int type;
+ PROC_LOCK_ASSERT(p, MA_OWNED);
+
if (throttle) {
p->p_flag |= P_THROTTLED;
newpri = PRI_MIN_IDLE;
@@ -781,6 +783,7 @@
FOREACH_PROC_IN_SYSTEM(p) {
pctcpu_limit = rusage_get_limit(p, RUSAGE_PCTCPU);
pctcpu = 0;
+ PROC_LOCK(p);
PROC_SLOCK(p);
FOREACH_THREAD_IN_PROC(p, td) {
ruxagg(p, td);
@@ -788,15 +791,14 @@
pctcpu += sched_pctcpu(td);
thread_unlock(td);
}
+ PROC_SUNLOCK(p);
pctcpu = ((pctcpu * 10000 + FSCALE / 2) >> FSHIFT) / 100;
if (pctcpu > pctcpu_limit)
rusage_throttle(p, 1);
else
rusage_throttle(p, 0);
- PROC_SUNLOCK(p);
microuptime(&wallclock);
timevalsub(&wallclock, &p->p_stats->p_start);
- PROC_LOCK(p);
rusage_set(p, RUSAGE_WALLCLOCK, wallclock.tv_sec * 1000000 + wallclock.tv_usec);
rusage_set(p, RUSAGE_PCTCPU, pctcpu);
rusage_set(p, RUSAGE_CPU, cputick2usec(p->p_rux.rux_runtime));
More information about the p4-projects
mailing list