mirror of
https://github.com/freebsd/freebsd-src
synced 2024-10-03 15:15:01 +00:00
Hopefully fix the "calcru: runtime went backwards from ..." problem by
keeping the resource values locked (where needed) while we use them for calculations. MFC after: 3 days
This commit is contained in:
parent
9fc31f8a5f
commit
03001f59c8
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=154731
|
@ -437,14 +437,13 @@ exit1(struct thread *td, int rv)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Save exit status and finalize rusage info except for times,
|
* Save exit status and finalize rusage info except for times,
|
||||||
* adding in child rusage info.
|
* adding in child rusage info later when our time is locked.
|
||||||
*/
|
*/
|
||||||
PROC_LOCK(p);
|
PROC_LOCK(p);
|
||||||
p->p_xstat = rv;
|
p->p_xstat = rv;
|
||||||
p->p_xthread = td;
|
p->p_xthread = td;
|
||||||
p->p_stats->p_ru.ru_nvcsw++;
|
p->p_stats->p_ru.ru_nvcsw++;
|
||||||
*p->p_ru = p->p_stats->p_ru;
|
*p->p_ru = p->p_stats->p_ru;
|
||||||
ruadd(p->p_ru, &p->p_rux, &p->p_stats->p_cru, &p->p_crux);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Notify interested parties of our demise.
|
* Notify interested parties of our demise.
|
||||||
|
@ -531,6 +530,8 @@ exit1(struct thread *td, int rv)
|
||||||
p->p_state = PRS_ZOMBIE;
|
p->p_state = PRS_ZOMBIE;
|
||||||
PROC_UNLOCK(p->p_pptr);
|
PROC_UNLOCK(p->p_pptr);
|
||||||
|
|
||||||
|
ruadd(p->p_ru, &p->p_rux, &p->p_stats->p_cru, &p->p_crux);
|
||||||
|
|
||||||
/* Do the same timestamp bookkeeping that mi_switch() would do. */
|
/* Do the same timestamp bookkeeping that mi_switch() would do. */
|
||||||
binuptime(&new_switchtime);
|
binuptime(&new_switchtime);
|
||||||
bintime_add(&p->p_rux.rux_runtime, &new_switchtime);
|
bintime_add(&p->p_rux.rux_runtime, &new_switchtime);
|
||||||
|
|
|
@ -733,8 +733,8 @@ calcru(p, up, sp)
|
||||||
&pcpu_find(td->td_oncpu)->pc_switchtime);
|
&pcpu_find(td->td_oncpu)->pc_switchtime);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mtx_unlock_spin(&sched_lock);
|
|
||||||
calcru1(p, &rux, up, sp);
|
calcru1(p, &rux, up, sp);
|
||||||
|
mtx_unlock_spin(&sched_lock);
|
||||||
p->p_rux.rux_uu = rux.rux_uu;
|
p->p_rux.rux_uu = rux.rux_uu;
|
||||||
p->p_rux.rux_su = rux.rux_su;
|
p->p_rux.rux_su = rux.rux_su;
|
||||||
p->p_rux.rux_iu = rux.rux_iu;
|
p->p_rux.rux_iu = rux.rux_iu;
|
||||||
|
|
Loading…
Reference in a new issue