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)
Tue, Jul 7, 4:37 PM
Unknown Object (File)
Sun, Jul 5, 4:37 PM
Unknown Object (File)
Fri, Jul 3, 2:44 AM
Unknown Object (File)
Sun, Jun 28, 2:25 PM
Unknown Object (File)
Sat, Jun 27, 7:41 PM
Unknown Object (File)
Fri, Jun 26, 3:56 AM
Unknown Object (File)
Thu, Jun 25, 2:48 AM
Unknown Object (File)
May 21 2026, 8:53 AM
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