HomeFreeBSD

racct: Simplify skipping idle process in the throttling daemon

Description

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)

Details

Provenance
olceAuthored on Oct 29 2025, 3:47 PM
Reviewer
markj
Differential Revision
D53455: racct: Simplify skipping idle process in the throttling daemon
Parents
rGfd404e957dd9: racct: Fix accounting of CPU time for the system idle process
Branches
Unknown
Tags
Unknown