Skip to content

Commit acd0244

Browse files
committed
proc0_post: Clear relevant thread stats directly
rufetch() has several other effects besides clearing these per-thread stats most of which are explicitly discarded by the subsequent calls to ruxreset(). Just clear the relevant stats directly instead. Reviewed by: olce, kib, markj Differential Revision: https://reviews.freebsd.org/D54050
1 parent dafe50e commit acd0244

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

sys/kern/init_main.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -643,7 +643,6 @@ static void
643643
proc0_post(void *dummy __unused)
644644
{
645645
struct proc *p;
646-
struct rusage ru;
647646
struct thread *td;
648647

649648
/*
@@ -660,11 +659,15 @@ proc0_post(void *dummy __unused)
660659
}
661660
microuptime(&p->p_stats->p_start);
662661
PROC_STATLOCK(p);
663-
rufetch(p, &ru); /* Clears thread stats */
664662
ruxreset(&p->p_rux);
665663
FOREACH_THREAD_IN_PROC(p, td) {
666-
td->td_runtime = 0;
667664
thread_lock(td);
665+
td->td_incruntime = 0;
666+
td->td_runtime = 0;
667+
td->td_pticks = 0;
668+
td->td_sticks = 0;
669+
td->td_iticks = 0;
670+
td->td_uticks = 0;
668671
ruxreset(&td->td_rux);
669672
thread_unlock(td);
670673
}

0 commit comments

Comments
 (0)