Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 19 Dec 2025 15:32:42 +0000
From:      John Baldwin <jhb@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 7087adfd960a - stable/14 - proc0_post: Clear relevant thread stats directly
Message-ID:  <6945701a.447be.18fd3a44@gitrepo.freebsd.org>

index | next in thread | raw e-mail

The branch stable/14 has been updated by jhb:

URL: https://cgit.FreeBSD.org/src/commit/?id=7087adfd960af71fba968371439a706badf830e9

commit 7087adfd960af71fba968371439a706badf830e9
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2025-12-08 16:15:52 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2025-12-19 15:19:41 +0000

    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
    
    (cherry picked from commit acd02443a952b1f5412d35d03f081ad48bae34d7)
---
 sys/kern/init_main.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/sys/kern/init_main.c b/sys/kern/init_main.c
index 51a6e7e7d909..65795eea183e 100644
--- a/sys/kern/init_main.c
+++ b/sys/kern/init_main.c
@@ -645,7 +645,6 @@ static void
 proc0_post(void *dummy __unused)
 {
 	struct proc *p;
-	struct rusage ru;
 	struct thread *td;
 
 	/*
@@ -662,11 +661,15 @@ proc0_post(void *dummy __unused)
 		}
 		microuptime(&p->p_stats->p_start);
 		PROC_STATLOCK(p);
-		rufetch(p, &ru);	/* Clears thread stats */
 		ruxreset(&p->p_rux);
 		FOREACH_THREAD_IN_PROC(p, td) {
-			td->td_runtime = 0;
 			thread_lock(td);
+			td->td_incruntime = 0;
+			td->td_runtime = 0;
+			td->td_pticks = 0;
+			td->td_sticks = 0;
+			td->td_iticks = 0;
+			td->td_uticks = 0;
 			ruxreset(&td->td_rux);
 			thread_unlock(td);
 		}


help

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?6945701a.447be.18fd3a44>