From nobody Fri Dec 19 09:19:17 2025 X-Original-To: dev-commits-src-branches@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 4dXhn14hN2z6L9vZ for ; Fri, 19 Dec 2025 09:19:17 +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 4dXhn12Prcz455B for ; Fri, 19 Dec 2025 09:19:17 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1766135957; 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=ie8ypwTJS8dyvmsmEbL2IX2Rf6JTULm2zxy59TZLWdY=; b=wx9gVtLgHylUvm98wo+7XFp65N+KffTYSyyUJTvcGwTu3BHVjSVMdfuZypYSbi1W27NuAK P8Ot7IfXFiWYbUfKKHWf58KDnpW3cjyZ+su0H+Fm8QAKsH/XOfB/fhKqV6ReiqW38RAQgx 0qc+D7nU6OsxKlcIsjIE7fdZa9Bs/UeZ6rX3f3twxCNzlvVtgAmrNpJ7TAxlznImNMoS46 1t5s6/yi5j+IjmDf+VTvTzuIBDucSpbRDVFZUveXG/fLhi+dVj5/+nMPxt3yK1fPvNSRs+ orjEvFwB6LneWyZ3Y1ENQwF0kGr8an5fF3jwGf9z6GW2xSJPBOnr4b0hdnWsrw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1766135957; 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=ie8ypwTJS8dyvmsmEbL2IX2Rf6JTULm2zxy59TZLWdY=; b=HLtP11jOjYGsZDLLit1drOoZ8gRhhn1x/X2m3tXH77IE3foK7+1TqjT9ijC6MwJWcE50a5 L56+RTR7I4Q7zNZSPZGabBp8SwXoU+jz4nSFgSLNaEydbtV8mhAY1cJt0gJwBcvREtkb5n FDsrdeQLDvfOFS0T8XbqCpb+LvbdymZAH+XH+HkfNgpc2J1tDh6uLPDt7faEwrxLEj+91o +Ok4rdHVCGP8xABEV6KBJ9KMmSWZAzt0/nyi+QOo5RNpkrIDpwfDk1isUlg76MOPUCxggz aBbJVO0ta7Xs821PBlpTmxLU3CXytkTv8qS02sE8kKBfS/FKhsA0kHH3wSnQ8g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1766135957; a=rsa-sha256; cv=none; b=E2jKug0now2NoQRXiTlunHhS//TrqiCr9+HXFgy78aoldAUD+IUXa6NgFquXRXjbGwEdPk 2Q3IPViWbyBsu2KlNqoReI3xb7vMSgRpsrUFWKx3G2mlovstqEQH1wlvxH4HCgsOQoqN5E yGEx1t/HDB89fbdSl4rP4489GzaELOhOQy73LIMBO0bkrea9uLd8rbkHzRTu6gxj2YAeqC V9Uy6T8pq3rhZTMBOKMbC2Ox5Gw5pl+Dxol/3p7kaBQgr1m3+6dw9ep1Q//aYDaC9Rz8eh LDGvOXc/8hW/QaRNPJJHG7CDBzZ7lj1/nipzjQ3SSS4nAOKDFtWzZH5xR+kJSw== 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 4dXhn11yXpz1GKy for ; Fri, 19 Dec 2025 09:19:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3f0fc by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Fri, 19 Dec 2025 09:19:17 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Olivier Certner Subject: git: bd26c99b688e - stable/14 - racct: Simplify skipping idle process in the throttling daemon List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: olce X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: bd26c99b688e4f9dabfc477d6e89ead587f923f4 Auto-Submitted: auto-generated Date: Fri, 19 Dec 2025 09:19:17 +0000 Message-Id: <69451895.3f0fc.100b66eb@gitrepo.freebsd.org> The branch stable/14 has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=bd26c99b688e4f9dabfc477d6e89ead587f923f4 commit bd26c99b688e4f9dabfc477d6e89ead587f923f4 Author: Olivier Certner AuthorDate: 2025-10-29 15:47:25 +0000 Commit: Olivier Certner CommitDate: 2025-12-19 09:16:47 +0000 racct: Simplify skipping idle process in the throttling daemon In racctd(), commit c72188d85a79 ("racct: Improve handling of the pcpu resource") added a superfluous test to skip the idle process when computing the resource usage and checking for limits, consisting of a comparison of the considered process' pointer with that of the process of the first CPU's idle thread. The P_IDLEPROC flag introduced in commit 33be1632047c ("racct: Fix accounting of CPU time for the system idle process") is sufficient and simpler for this purpose. In the second loop throttling processes based on their %CPU usage, the test excluding processes not in PRS_NORMAL was not consistent with that of the first loop (which tests for the idle process also). This had no practical consequences except a superfluous call to racct_pcpu_available() as the RACCT_PCTCPU counter stays at 0 on the idle process (because of the first loop). Factor out the test in the new racct_proc_to_skip() function. No functional change intended. Reviewed by: markj MFC after: 3 days Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D53455 (cherry picked from commit 9530c6f082ada9e6d0323f36697ce53997ab2326) --- sys/kern/kern_racct.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/sys/kern/kern_racct.c b/sys/kern/kern_racct.c index 13df4724f860..0e359dfe85cf 100644 --- a/sys/kern/kern_racct.c +++ b/sys/kern/kern_racct.c @@ -1226,6 +1226,13 @@ racct_decay(void) racct_decay_post, NULL, NULL); } +static bool +racct_proc_to_skip(const struct proc *p) +{ + PROC_LOCK_ASSERT(p, MA_OWNED); + return (p->p_state != PRS_NORMAL || (p->p_flag & P_IDLEPROC) != 0); +} + static void racctd(void) { @@ -1243,8 +1250,7 @@ racctd(void) FOREACH_PROC_IN_SYSTEM(p) { PROC_LOCK(p); - if (p->p_state != PRS_NORMAL || - (p->p_flag & P_IDLEPROC) != 0) { + if (racct_proc_to_skip(p)) { if (p->p_state == PRS_ZOMBIE) racct_set(p, RACCT_PCTCPU, 0); PROC_UNLOCK(p); @@ -1297,7 +1303,7 @@ racctd(void) */ FOREACH_PROC_IN_SYSTEM(p) { PROC_LOCK(p); - if (p->p_state != PRS_NORMAL) { + if (racct_proc_to_skip(p)) { PROC_UNLOCK(p); continue; }