From nobody Mon Dec 8 16:16:33 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4dQ6YZ10xmz6K2Rj for ; Mon, 08 Dec 2025 16:16:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R12" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4dQ6YY6xtBz3H1M for ; Mon, 08 Dec 2025 16:16:33 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1765210594; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=jpU0Y+irHG9yuPVvtfCeL/W3+KwCJU0m1NjADyMt8K4=; b=rZV4+8xbTuqiaE1V5V2DLAqNC8jU+Jk6k0+ZmyrJII8OyVK8JPyjK/EUFSf1Y9ye2ckaQQ rcMP+S710ix7htg7WdPw/OZlJe3M21LeBljGBQuDPfSe5jIoC/PdtYV+ZScpyNuPYFl63K 81TizbPd1Oed2SB5rr4XCGXKRm0gLOeNINYVHKbA0fAMu1f0GYfCfwkw9HVgysxyKxy6Y2 iMUDkdhrHGqIj8PQ63cTWjVmMDxhKYB/xldurRsyITcpfYYpBmLoCZVSuI2YVUxoGxPxwD 4jbuvk4lkD2qCR5vZWewI1wN2+BTjPHX9H0tkNRehYn/f8xDr33AhFfK7yZ/ZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1765210594; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=jpU0Y+irHG9yuPVvtfCeL/W3+KwCJU0m1NjADyMt8K4=; b=bykP6NnuVdQszEFWxzRkdamXBgBae3f9ckE/wVkdWLVXPS23wd+wpMJh8X47NJ7DCd1KgM uUWbAy99ub0UO98mJD3ovGxq9+/r0DyptATgPYDDpI4fCmQemQkTn4vWK0Tp55j8sKyW1M ecR0fKvttRNL0GUZL9I2UFoEnruraACg/tlyWYj2vKbPLAIlAfh9Ye2ecXrtOXfrSQTepN retf/sKiWAVNE8hYF3tBmMV4CgGZvgjGvyXOukSO+e0Oky5FOLO1WtpllNrN+6IBWY6AlC Qdy0/r0Qgx7KWxFFEiPQlIykyll6ShNZO4lGlPaQnkVxF2naOQtlAd5j3/Xv2w== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1765210594; a=rsa-sha256; cv=none; b=o7tAjfidswFHpZZ6HDQaswMOLoQ5P7qiZ2HZLleaBYCqqrClPqW6sAtQyLNXSMhgVlamIr pWElPX9D86KwUkYkH9dKkI5AmsktP4XDS4EieXsjeVpL6tUjvVuCEQ30PrqBAMuPvr+1UX WAOF/5HifbKst2r5VgLI3AX18K7RYoguDH/5CYz60Hq/E8Qjdskqk3ihPOVm1AZRTujXnT YLg9rlEzhUjdxyJMJAwOX/Ua8g69huRqPidEEeRWa9aM1gjDFlCOavrd2qNE97HayUEijD jK/CrU802swDLelNSXouFvIacASZtp6hBLWYwu0EFNyoYccpOqS3VYR+w76IbA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4dQ6YY6H4tz48D for ; Mon, 08 Dec 2025 16:16:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3b936 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Mon, 08 Dec 2025 16:16:33 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: dafe50ebd874 - main - thread0: Clear td_rux stats in proc0_post List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: dafe50ebd874ca3ccd5908c441cee9f478c501f0 Auto-Submitted: auto-generated Date: Mon, 08 Dec 2025 16:16:33 +0000 Message-Id: <6936f9e1.3b936.43b92bf4@gitrepo.freebsd.org> The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=dafe50ebd874ca3ccd5908c441cee9f478c501f0 commit dafe50ebd874ca3ccd5908c441cee9f478c501f0 Author: John Baldwin AuthorDate: 2025-12-08 16:15:36 +0000 Commit: John Baldwin CommitDate: 2025-12-08 16:16:13 +0000 thread0: Clear td_rux stats in proc0_post proc0_post aims to reset the CPU usage accounting for all threads and processes in the system to zero once the time of day is verified. However, not all of the per-thread stats were not being cleared, resulting in over-reported time for thread0 post-boot. Reviewed by: olce, kib, markj Fixes: bed4c5241663 ("Implement RUSAGE_THREAD. Add td_rux...") Differential Revision: https://reviews.freebsd.org/D54040 --- sys/kern/init_main.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/sys/kern/init_main.c b/sys/kern/init_main.c index 6495340578da..8d1ee7b0fd99 100644 --- a/sys/kern/init_main.c +++ b/sys/kern/init_main.c @@ -648,7 +648,8 @@ proc0_post(void *dummy __unused) /* * Now we can look at the time, having had a chance to verify the - * time from the filesystem. Pretend that proc0 started now. + * time from the filesystem. Pretend that all current threads + * started now. */ sx_slock(&allproc_lock); FOREACH_PROC_IN_SYSTEM(p) { @@ -661,10 +662,13 @@ proc0_post(void *dummy __unused) PROC_STATLOCK(p); rufetch(p, &ru); /* Clears thread stats */ ruxreset(&p->p_rux); - PROC_STATUNLOCK(p); FOREACH_THREAD_IN_PROC(p, td) { td->td_runtime = 0; + thread_lock(td); + ruxreset(&td->td_rux); + thread_unlock(td); } + PROC_STATUNLOCK(p); PROC_UNLOCK(p); } sx_sunlock(&allproc_lock);