- Assert that any process that has statclock called on it has both a
stats structure and a vmspace as this should always be true rather than checking the always true condition in an if statement. - Remove never-false check: if ((ru = &pstats->p_ru) != NULL) - Remove pstats variable that is only used once and inline its one use instead.
This commit is contained in:
parent
3320b0b2e5
commit
16f9f20579
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=131436
@ -374,7 +374,6 @@ void
|
||||
statclock(frame)
|
||||
register struct clockframe *frame;
|
||||
{
|
||||
struct pstats *pstats;
|
||||
struct rusage *ru;
|
||||
struct vmspace *vm;
|
||||
struct thread *td;
|
||||
@ -427,16 +426,16 @@ statclock(frame)
|
||||
sched_clock(td);
|
||||
|
||||
/* Update resource usage integrals and maximums. */
|
||||
if ((pstats = p->p_stats) != NULL &&
|
||||
(ru = &pstats->p_ru) != NULL &&
|
||||
(vm = p->p_vmspace) != NULL) {
|
||||
ru->ru_ixrss += pgtok(vm->vm_tsize);
|
||||
ru->ru_idrss += pgtok(vm->vm_dsize);
|
||||
ru->ru_isrss += pgtok(vm->vm_ssize);
|
||||
rss = pgtok(vmspace_resident_count(vm));
|
||||
if (ru->ru_maxrss < rss)
|
||||
ru->ru_maxrss = rss;
|
||||
}
|
||||
MPASS(p->p_stats != NULL);
|
||||
MPASS(p->p_vmspace != NULL);
|
||||
vm = p->p_vmspace;
|
||||
ru = &p->p_stats->p_ru;
|
||||
ru->ru_ixrss += pgtok(vm->vm_tsize);
|
||||
ru->ru_idrss += pgtok(vm->vm_dsize);
|
||||
ru->ru_isrss += pgtok(vm->vm_ssize);
|
||||
rss = pgtok(vmspace_resident_count(vm));
|
||||
if (ru->ru_maxrss < rss)
|
||||
ru->ru_maxrss = rss;
|
||||
mtx_unlock_spin_flags(&sched_lock, MTX_QUIET);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user