PERFORCE change 105247 for review
Chris Jones
cdjones at FreeBSD.org
Tue Aug 29 05:52:46 UTC 2006
http://perforce.freebsd.org/chv.cgi?CH=105247
Change 105247 by cdjones at cdjones_meanook on 2006/08/29 05:52:13
Quick speedup per 21 Aug 2006 mail to freebsd-hackers@; if we have no jails, there's no reason to do any of this.
Affected files ...
.. //depot/projects/soc2006/cdjones_jail/src/sys/kern/sched_4bsd.c#10 edit
Differences ...
==== //depot/projects/soc2006/cdjones_jail/src/sys/kern/sched_4bsd.c#10 (text+ko) ====
@@ -463,13 +463,13 @@
* TODO: this is excessively icky.
*/
sx_slock(&allproc_lock);
- mtx_lock(&allprison_mtx);
- if (prisoncount) {
+ if (prisoncount && sched_limitjailcpu) {
+ mtx_lock(&allprison_mtx);
LIST_FOREACH(pr, &allprison, pr_list) {
pr->pr_estcpu = 0;
}
+ total_est_cpu = 0;
}
- total_est_cpu = 0;
FOREACH_PROC_IN_SYSTEM(p) {
/*
* Prevent state changes and protect run queue.
@@ -554,12 +554,13 @@
if (kg->kg_slptime > 1)
continue;
kg->kg_estcpu = decay_cpu(loadfac, kg->kg_estcpu);
- total_est_cpu += kg->kg_estcpu;
- if (sched_limitjailcpu &&
- NULL != kg->kg_proc->p_ucred &&
- NULL != kg->kg_proc->p_ucred->cr_prison)
- kg->kg_proc->p_ucred->cr_prison->pr_estcpu +=
- kg->kg_estcpu;
+ if (prisoncount && sched_limitjailcpu) {
+ total_est_cpu += kg->kg_estcpu;
+ if (NULL != kg->kg_proc->p_ucred &&
+ NULL != kg->kg_proc->p_ucred->cr_prison)
+ kg->kg_proc->p_ucred->cr_prison->pr_estcpu +=
+ kg->kg_estcpu;
+ }
resetpriority(kg);
FOREACH_THREAD_IN_GROUP(kg, td) {
resetpriority_thread(td, kg);
@@ -567,7 +568,8 @@
} /* end of ksegrp loop */
mtx_unlock_spin(&sched_lock);
} /* end of process loop */
- mtx_unlock(&allprison_mtx);
+ if (prisoncount && sched_limitjailcpu)
+ mtx_unlock(&allprison_mtx);
sx_sunlock(&allproc_lock);
}
@@ -582,7 +584,7 @@
u_int32_t shares = 0;
for (;;) {
- if (sched_limitjailcpu) {
+ if (prisoncount && sched_limitjailcpu) {
/*
* Update total jail CPU shares in case they've changed.
* Safe to read pr_sched_shares without mutex because
@@ -645,7 +647,7 @@
if (kg->kg_pri_class == PRI_TIMESHARE) {
newpriority = PUSER + kg->kg_estcpu / INVERSE_ESTCPU_WEIGHT +
NICE_WEIGHT * (kg->kg_proc->p_nice - PRIO_MIN);
- if (sched_limitjailcpu && NULL != pr) {
+ if (prisoncount && sched_limitjailcpu && NULL != pr) {
/*
* Skew the priority by the jail's share of CPU resources.
* The unjailed processes get half the CPU time.
More information about the p4-projects
mailing list