Page MenuHomeFreeBSD

racct: Simplify skipping idle process in the throttling daemon
ClosedPublic

Authored by olce on Oct 29 2025, 8:52 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Dec 18, 3:28 PM
Unknown Object (File)
Wed, Dec 17, 10:33 AM
Unknown Object (File)
Sun, Dec 14, 9:54 PM
Unknown Object (File)
Sun, Dec 7, 4:03 AM
Unknown Object (File)
Fri, Nov 28, 2:41 PM
Unknown Object (File)
Wed, Nov 26, 8:46 PM
Unknown Object (File)
Nov 17 2025, 5:58 PM
Unknown Object (File)
Nov 5 2025, 6:51 PM
Subscribers

Details

Summary

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.

Sponsored by: The FreeBSD Foundation

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable