diff options
Diffstat (limited to 'sys/kern/kern_resource.c')
-rw-r--r-- | sys/kern/kern_resource.c | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/sys/kern/kern_resource.c b/sys/kern/kern_resource.c index 3bb8dee40284d..99efe979aa201 100644 --- a/sys/kern/kern_resource.c +++ b/sys/kern/kern_resource.c @@ -78,7 +78,7 @@ static void calcru1(struct proc *p, struct rusage_ext *ruxp, struct timeval *up, struct timeval *sp); static int donice(struct thread *td, struct proc *chgp, int n); static struct uidinfo *uilookup(uid_t uid); -static void ruxagg_locked(struct rusage_ext *rux, struct thread *td); +static void ruxagg_ext_locked(struct rusage_ext *rux, struct thread *td); /* * Resource controls and accounting. @@ -858,7 +858,7 @@ rufetchtd(struct thread *td, struct rusage *ru) td->td_incruntime += runtime; PCPU_SET(switchtime, u); } - ruxagg(p, td); + ruxagg_locked(p, td); *ru = td->td_ru; calcru1(p, &td->td_rux, &ru->ru_utime, &ru->ru_stime); } @@ -1114,11 +1114,9 @@ ruadd(struct rusage *ru, struct rusage_ext *rux, struct rusage *ru2, * Aggregate tick counts into the proc's rusage_ext. */ static void -ruxagg_locked(struct rusage_ext *rux, struct thread *td) +ruxagg_ext_locked(struct rusage_ext *rux, struct thread *td) { - THREAD_LOCK_ASSERT(td, MA_OWNED); - PROC_STATLOCK_ASSERT(td->td_proc, MA_OWNED); rux->rux_runtime += td->td_incruntime; rux->rux_uticks += td->td_uticks; rux->rux_sticks += td->td_sticks; @@ -1126,16 +1124,25 @@ ruxagg_locked(struct rusage_ext *rux, struct thread *td) } void -ruxagg(struct proc *p, struct thread *td) +ruxagg_locked(struct proc *p, struct thread *td) { + THREAD_LOCK_ASSERT(td, MA_OWNED); + PROC_STATLOCK_ASSERT(td->td_proc, MA_OWNED); - thread_lock(td); - ruxagg_locked(&p->p_rux, td); - ruxagg_locked(&td->td_rux, td); + ruxagg_ext_locked(&p->p_rux, td); + ruxagg_ext_locked(&td->td_rux, td); td->td_incruntime = 0; td->td_uticks = 0; td->td_iticks = 0; td->td_sticks = 0; +} + +void +ruxagg(struct proc *p, struct thread *td) +{ + + thread_lock(td); + ruxagg_locked(p, td); thread_unlock(td); } |