betaFeedback

WorksComputer Science

Resolving an Idle-Time Accounting Hazard in Linux Load Balancing

Abstract

The Linux kernel scheduler uses per-runqueue idle-time history (avg_idle) to decide whether searching other CPUs for runnable work justifies its execution overhead. This estimate is an active input to new-idle load balancing, helping determine whether a search continues across scheduling domains. This operational study presents the design and subsequent hardening of idle-time accounting through two upstream patch series. The original wakeup-side accounting missed legitimate idle exits associated with task creation, exec-related placement paths, and load-balancing migration. Introducing update_rq_avg_idle() and moving accounting to idle-task switch-out broadened coverage beyond wakeup-specific arrival paths. However, the broader consumer could also reach histories without a valid start timestamp. Subtracting zero from the runqueue clock constructs a sample unrelated to the measured idle interval and can rapidly saturate the bounded estimator, weakening new-idle balance cost gating. We describe the accounting redesign and its refinement using public development archives, patch iterations (v1-v8 and v1-v3), runtime tracing, independent review, and upstream integration records. A configuration-independent ttwu_pending history reaches the relocated consumer without a compatible measurement start. Core Scheduling force-idling and proxy execution further show why mechanically symmetric idle-entry timestamping is insufficient. From this incident and two retrospective scheduler cases, we extract a state-lifetime audit organized around missing establishment, premature consumption, and stale consumption. We distinguish these correctness findings from performance attribution, for which a controlled three-variant experiment remains necessary.

Introduction

Operating-system schedulers rely on state accumulated across execution events to guide resource allocation. In Linux, per-runqueue idle-time history participates in the cost decisions governing new-idle load balancing across multicore scheduling domains. Once historical state feeds such policy, its semantic lifetime becomes part of policy correctness.

A consumer can observe semantically invalid state even when the arithmetic is locally sound. An expected producer may not have executed along a control path; a consumer may run before prerequisite updates; or an initialized value from an earlier epoch may survive into a context where its meaning is invalid.

This paper investigates that boundary through the introduction of update_rq_avg_idle(), the relocation of idle-time accounting to put_prev_task_idle(), and the subsequent refinement of the helper’s measurement-validity check. The redesign changes the event at which idle-duration state is consumed; the follow-up repair refines the validity condition at that broader boundary.

The original accounting consumed idle_stamp along wakeup-oriented paths. It failed to capture some transitions where idle CPUs acquired runnable work through task creation, exec-related placement, or load-balancing migration [9]. Consequently, some idle exits occurred without contributing a sample to avg_idle. The resulting bias depends on the omitted intervals and the existing estimate; missing samples alone do not establish that the estimate is always too low.

The upstream change extracted update_rq_avg_idle() and relocated consumption to put_prev_task_idle(), binding accounting to switching away from the idle task rather than to how work arrived [11, 13]. Testing reported with the patch on an 80-core Ampere Altra using a 6.19-rc5 baseline reported a 7.2% hackbench performance improvement at 16 threads and reduced schbench p99.9p99.9 latency at high concurrency [11]. These are configuration-specific patch-submission results, not new measurements performed for this manuscript.

Independent evaluation by K. Prateek Nayak at AMD found substantial changes in scheduler activity: SMT-domain new-idle attempts rose from 3,964 to 17,961, and MC-domain attempts from 1,917 to 7,022. The same evaluation repeatedly observed sensitivity at tbench-256, while noting that profiling reruns reduced the apparent throughput difference to approximately 2%, within the stated margin of error [21].

The relocation also removed the nonzero-idle_stamp check present at the old consumer. Masahito S. independently observed that subtracting a zero timestamp constructs a runqueue-clock sample rather than elapsed idle time and can drive avg_idle to its 2×2 \times max_idle_balance_cost clamp [18]. Temporary tracing under hackbench later confirmed that update_rq_avg_idle() can execute with idle_stamp == 0 [10].

Upstream review identified a configuration-independent reachable history: when ttwu_pending is set, sched_balance_newidle() returns before establishing idle_stamp. The runqueue can subsequently execute the idle task and switch away from it after processing the pending wakeup [16, 29].

A symmetric-entry proposal would timestamp from set_next_task_idle(). But idle-task selection can occur under force-idling or proxy execution without representing the beginning of the ordinary interval summarized by avg_idle [10, 20]. Thus:

control-flow symmetry⇏measurement-lifetime symmetry.(1)\text{control-flow symmetry} \not\Rightarrow\text{measurement-lifetime symmetry}. \tag*{(1)}

The eventual correction retained the switch-out consumer and restored the nonzero guard [14]. It preserves the coverage change while rejecting the demonstrated histories lacking measurement establishment.

Contributions. First, the paper presents the helper introduction, accounting relocation, and subsequent validity refinement, supported by patch revisions, review, runtime observation, and upstream integration. Second, it separates semantic coverage from producer compatibility when a consumer moves. Third, it extracts a practical review procedure and applies it retrospectively to independent PELT and util_est/schedutil failures. The historical record does not isolate performance effects across all three accounting variants; that limitation remains explicit.

Operational Model and Review Questions

We model a stateful policy input as

M=(S,C,G),(2)\mathcal{M} = (S,C,G), \tag*{(2)}

where SS establishes or updates state, CC consumes it for a policy-relevant operation, and GG is the implementation predicate admitting consumption. The consumer operation is distinct from its syntactic site ECE_C. Each history considered here is truncated at one particular occurrence of that site; ordering is relative to that occurrence, not to a static source location across repeated executions. Let R(EC)R(E_C) be these histories reaching the site. The implementation admits consumption on

RG(C)={h∈R(EC)∣G(h,EC)}.(3)R_G(C) = \{h \in R(E_C) \mid G(h,E_C)\}. \tag*{(3)}

For each history hh, let ShS_h denote a relevant establishment event. Define semantically compatible histories as

RS(EC)={h∈R(EC)∣∃Sh:Sh≺hEC∧Compat⁡(Sh,EC,h)}.(4)R_S(E_C) = \{h \in R(E_C) \mid\exists S_h : S_h \prec_h E_C \land\operatorname{Compat}(S_h,E_C,h)\}. \tag*{(4)}

For the examined cases, compatibility requires checking at least:

  1. Semantic identity: Does the establishment represent the intended measurement interval or execution event?

  2. Ordering: Does it follow prerequisite transitions and precede consumption?

  3. Freshness: Does the state remain current for this consumption, rather than represent a superseded execution state?

The review obligation is

RG(C)⊆RS(EC).(5)R_G(C) \subseteq R_S(E_C). \tag*{(5)}

This is a semantic audit criterion, not an automated verifier. The nonzero timestamp guard rejects the demonstrated missing-establishment histories; nonzero alone does not generally prove provenance, ordering, or freshness.

Three Observed Lifetime Hazards

H1: Missing measurement establishment. For an admitted consumer occurrence, no producer established a measurement for the intended epoch. This is narrower than the general incompatibility condition h∈RG(C)∧h∉RS(EC)h \in R_G(C) \land h \notin R_S(E_C), which can also result from incorrect ordering or stale state. In this case, the zero sentinel identifies the absence of a measurement start. The zero timestamp is an initialized sentinel, not an uninitialized C-language read. The failure is the absence of the measurement it should represent.

H2: Premature consumption. A required predecessor update UU occurs too late:

C≺hUinstead ofU≺hC.(6)C \prec_h U \quad\text{instead of} \quad U \prec_h C. \tag*{(6)}

The PELT case synchronizes the idle clock before the previous scheduling class updates required signals.

H3: Stale consumption. An older value survives into an event requiring a refresh:

Sold≺hC≺hSe.(7)S_{\mathrm{old}} \prec_h C \prec_h S_e. \tag*{(7)}

The util_est case observes CPU utilization before its update for the current event. These hazards are useful, non-exhaustive review questions; they need not be disjoint categories.

Consumer Relocation

Moving a site from EC0EC_0 to EC1EC_1 makes histories newly reachable:

ΔR=R(EC1)∖R(EC0).(8)\Delta R = R(EC_1) \setminus R(EC_0). \tag*{(8)}

Admission additionally depends on GG. Review must ask both whether the newly reached events should consume the measurement and whether each newly admitted consumption has compatible producer state.

Linux Scheduler Background

Scheduling Domains and Search Cost

Linux scheduling domains are platform- and configuration-dependent CPU spans over which the scheduler searches for work or compares load. SMT, MC, PKG, and NUMA are labels in the examined statistics, not a universal fixed hierarchy or a one-to-one mapping to cache levels. When a CPU exhausts local work, new-idle balancing can search remote runqueues. The search can recover capacity but consumes scheduler time and may lead to migration. We do not decompose unmeasured lock, cache-coherence, or interconnect costs.

Measurement Interval and State Lifecycle

We pin the source analysis to the correction revision and its original accounting-change predecessor records [13, 16]. The start of the measured interval is the assignment in sched_balance_newidle(), before the balancing search. The source explicitly includes that search duration in idle-time accounting. The interval is therefore not identical to idle-task execution time, a hardware C-state residency, or instantaneous CPU availability.

If balancing obtains runnable work, the end path clears the timestamp without submitting an idle sample. If the scheduler proceeds into idle, the established timestamp can survive until the idle-task switch-out consumer. A path returning before the assignment can select the idle task without starting this measurement. The helper’s guard distinguishes these histories rather than mechanically timing every idle-task dispatch. Table 1 records the relevant state transitions.

Event / source siteState transitionMeasurement interpretation
Runqueue initialization (core.c 9066–9068)Timestamp starts at zero; estimator and cost have initial values.Zero is a sentinel, not an uninitialized read.
Pending-wakeup bailout (fair.c 14555–14556)Returns before timestamp establishment.Idle-task selection may occur without a measured interval.
New-idle establishment (fair.c 14559–14563)Timestamp receives the runqueue clock before search.The interval includes balancing work if it survives into idle.
Work obtained (fair.c 14673–14674)A nonzero pulled-task result clears the timestamp.No continuing idle interval is submitted on this branch.
Idle-class switch-out (idle.c 483–488; core.c 3743–3758)Guarded sample construction, estimator update, clamp, timestamp reset.Consume a represented interval once; otherwise skip sampling.

Table 1. Timestamp lifecycle in the pinned source revision [16]. Line ranges refer to the retained source snapshot.

Idle History and Search Termination

Linux tracks historical idle duration and new-idle balancing cost. Writing AkA_k for avg_idle, the exponentially weighted update is idealized without integer rounding as

Ak=78Ak−1+18Δidle.(9)A_k = \frac{7}{8} A_{k-1} + \frac{1}{8} \Delta_{\mathrm{idle}}. \tag*{(9)}

Let CdC_d denote the relevant scheduling-domain new-idle cost and CspentC_{\mathrm{spent}} the cost already incurred. Relevant comparisons can be abstracted as

TerminateSearch⁡⇐A<Cd,(10)\operatorname{TerminateSearch} \Leftarrow A < C_d, \tag*{(10)}
AbortSearch⁡⇐A<Cspent+Cd.(11)\operatorname{AbortSearch} \Leftarrow A < C_{\mathrm{spent}} + C_d. \tag*{(11)}

These isolate avg_idle-dependent predicates, not the complete control flow, which also depends on eligibility, pending wakeups, and other conditions. Driving AA to its clamp can weaken these cost gates; passing a gate does not guarantee a task will be found or migrated. In the pinned source, the initial check also depends on root-domain overload (fair.c 14584); the per-domain check occurs at 14606. A separate NO_HZ consumer compares avg_idle with migration cost before requesting blocked-load maintenance (14504). Other flags and randomized balancing can still restrict search [16].

Closing the Coverage Gap: Helper Introduction and Relocation

The Original Wakeup-Side Consumer

Before relocation, the relevant accounting was attached to a wakeup path:

if (rq->idle_stamp) {
    u64 delta = rq_clock(rq) - rq->idle_stamp;
    update_avg(&rq->avg_idle, delta);
    if (rq->avg_idle > 2 * rq->max_idle_balance_cost)
        rq->avg_idle = 2 * rq->max_idle_balance_cost;
    rq->idle_stamp = 0;
}

Listing 1: Simplified original accounting.

It both restricted the arrival paths reaching consumption and guarded sample construction with a nonzero timestamp.

The Coverage Defect

Task creation, exec-related placement, and load-balancing migration were identified as arrival classes that could bypass the wakeup-side site [9]. Their exact control flow differs; the shared property is an idle exit without executing that accounting point. This does not mean every fork, exec, or migration has this behavior. Omitted samples make the accounting incomplete, but the direction of estimator bias depends on the intervals and existing history. Table 2 identifies concrete source chains. These are source-level arrival mechanisms, not newly collected runtime traces. The relevant case is a destination already executing the idle task with an established measurement, followed by arrival and a switch-out; merely executing fork, exec, or migration is not sufficient.

Arrival classDestination activation chainCoverage condition and limit
Ordinary wakeupttwu_do_activate() → activate_task().Reaches the original wakeup-side site; relocated accounting instead consumes at idle-class switch-out.
New taskwake_up_new_task() → activate_task() (core.c 4957–4979).Direct activation bypasses the old site. A later idle-class switch-out reaches the helper if this arrival ends an established idle interval.
Load-balance attachmentattach_tasks() → attach_task() → activate_task() (fair.c 11164–11177; sched.h 3122–3128).Direct destination attachment bypasses the wakeup-side site. Successful local new-idle pulling can clear the stamp instead of entering idle.
Exec-related migrationsched_exec() selects another CPU; stopper migration can proceed through __migrate_task() → move_queued_task() → activate_task().Conditional migration path, not every exec. Destination activation bypasses the old site; affinity, task state, and intervening scheduler activity constrain whether it ends a measured idle interval.

Table 2. Arrival-path coverage audit in the pinned source [16]. The old accounting site is ttwu_do_activate(); the relocated site is idle-class switch-out.

Extracting the Helper and Moving the Boundary

The change introduced update_rq_avg_idle() and invoked it at put_prev_task_idle():

Simplified switch-out call site

Figure 2. Simplified switch-out call site; the signature is abbreviated.

Intermediate revisions explored activate_task() and enqueue_task(); v7 moved the helper to idle-task switch-out, and v8 removed the timestamp guard [11]. The design thus changed the organizing event from a particular task-arrival mechanism to a common idle-exit boundary. Activation-site alternatives track arrival rather than actual idle-class switch-out and must account for arrivals that do not produce that transition. Conversely, switch-out centralizes completion but expands the histories reaching the consumer, requiring an explicit measurement-validity check. These are design trade-offs exposed by the source structure, not measurements comparing all intermediate patch revisions. The original patch-submission measurements reported benefits on the 80-core Ampere system, and the change was integrated into the scheduler tree [11, 13].

Behavioral Evidence from Upstream Testing

Independent Scheduler Statistics

K. Prateek Nayak’s review reported no broad regression, but recurring bench-256 sensitivity. The initial mean-throughput comparison was −5%; profiling reruns were closer to approximately −2%, described as within the margin of error. The reviewer noted bench’s short sleeps and client/server locality within an LLC domain [21].

The profiling windows lasted 20,402 and 20,396 jiffies. Table 3 reports counts over those nearly equal windows, not universal rates. SMT attempts increased approximately 4.53× and MC attempts 3.66×. Derived success fractions rose from 4.77% to 5.63% at SMT and from 2.92% to 3.10% at MC. PKG and NUMA attempts decreased. The derived success counts are not direct task-migration counts: the baseline PKG record reports one derived success but zero tasks gained. Their derivation matters when interpreting balancing outcomes.

DomainAttempts BeforeAttempts AfterDerived successes BeforeDerived successes After
SMT3,96417,9611891,011
MC1,9177,02256218
PKG431310
NUMA21411

Table 3. Independent review statistics. Success counts are derived by the profiling tool [21].

The activity change is therefore topology dependent. It does not establish that a particular invalid timestamp update caused the application-level throughput difference, nor that additional search is always useful.

Evolution of the accounting boundary across three implementation states

Figure 2 (PDF p. 5). Evolution of the accounting boundary across three implementation states. The relocation addresses coverage; the refinement addresses validity without restoring wakeup-only accounting.

Measurement-to-Policy Path

For compatible establishment,

Δvalid=Trq−Sidle.(12)\Delta_{\mathrm{valid}} = T_{rq} - S_{\mathrm{idle}}. \tag*{(12)}

The initial relocated helper instead performed unconditional subtraction:

void update_rq_avg_idle(struct rq *rq) {
    u64 delta = rq_clock(rq) - rq->idle_stamp;
    u64 max = 2 * rq->max_idle_balance_cost;
    update_avg(&rq->avg_idle, delta);
    if (rq->avg_idle > max)
        rq->avg_idle = max;
    rq->idle_stamp = 0;
}

Listing 3: Simplified initial helper.

With a zero timestamp,

Δbad=Trq.(13)\Delta_{\mathrm{bad}} = T_{rq}. \tag*{(13)}

Zhan Xusheng’s review explains that roughly one eighth of the input difference is incorporated into the estimate. A sufficiently large runqueue clock can therefore drive avg_idle to its much smaller clamp on an incompatible update [29]. The problem is estimator saturation, not necessarily integer overflow. Ignoring integer rounding, with old estimate AA, sample TT, and clamp M=2max_idle_balance_costM = 2\mathrm{max\_idle\_balance\_cost}, saturation occurs when 7A+T≥8M7A + T \ge8M. The actual update uses a signed difference and integer division, so this expression is an explanatory condition within the ordinary representable range, not a universal arithmetic proof. The source-level control dependency in Figure 1 and independent workload statistics are distinct kinds of evidence.

Measurement-to-policy path

Figure 1. Measurement-to-policy path. The final guard acts before sample construction, not at the downstream cost comparisons. Search remains subject to other scheduler conditions.

Remaining Controlled Validation

The historical record establishes correctness reachability and behavioral sensitivity, but does not isolate the guard’s performance effect across three accounting states on one common kernel baseline. A controlled evaluation should compare:

  1. Wakeup-side baseline: guarded accounting with the original coverage limitation;

  2. Relocated-only: broader switch-out accounting without the validity guard;

  3. Final guarded: the same relocation with nonzero timestamp validation.

Use the same non-accounting kernel source, compiler, configuration, firmware, frequency policy, and benchmark harness. Record the exact accounting-only changes; comparing January and September snapshots would confound the result with unrelated scheduler development.

Prioritize the original hackbench and schbench configurations, tbench around the sensitive concurrency range, and a compute-bound control. Document exact commands and what threads, groups, and clients mean. Repeat runs sufficiently to report variability and justified confidence intervals rather than a best result. Measure runtime or throughput as defined by each harness, tail latency where applicable, migrations, and per-domain attempts and balancing outcomes.

Instrumentation should record attempted updates, timestamp validity, sample values, estimator before and after, and the contemporaneous clamp. Directed arrival-path tests should establish whether accounting is missed; zero-stamp traces should distinguish invalid consumption from valid, short idle intervals. Identifying the ttwu_pending cause requires path context, not only a zero-timestamp count. Instrumentation availability and overhead must be checked rather than assuming a particular tracepoint.

The questions are whether relocation closes the identified missing-update paths and how much behavioral change comes from coverage versus invalid sampling. This protocol specifies evidence still needed; it is not a completed experiment or a new performance result.

Missing Establishment After Relocation

Independent Diagnosis and Runtime Reachability

Masahito S. independently proposed restoring the guard and adding an idle-entry timestamp in set_next_task_idle() [18]. The eventual correction retains the first component but not the symmetric-entry change.

Temporary tracing reported in the correction thread confirmed entry to update_rq_avg_idle() with idle_stamp == 0. The correction thread reports no material hackbench regression against its stated comparison point [10]. The follow-up report describes repeated thread/process cases with mean deltas within approximately 1.5% and similar baseline variability [12]. Neither a trace file nor per-run measurements is supplied with this manuscript. The evidence is therefore an attributed observation, not an independently reproduced trace or a statistical equivalence result.

The Pending-Wakeup History

Review identified the relevant ordering in sched_balance_newidle() [16]:

if (this_rq->ttwu_pending)
    return 0;
/* ... */
this_rq->idle_stamp = rq_clock(this_rq);

Listing 4: Simplified ordering of bailout and timestamp establishment.

A runqueue can return before the assignment, execute the idle task, process the pending wakeup, and switch away from idle. The relocated consumer then executes without the expected measurement start. Figure 3 summarizes this ordering. For such a history,

Reachable pending-wakeup history

Figure 3. A reachable pending-wakeup history, not a deterministic workload trace. The validity guard separates reaching the consumer from constructing a measured idle-duration sample.

h∈R(EC1),h∉RS(EC1).(14)h \in R(E_{C_1}), \qquad h \notin R_S(E_{C_1}). \tag*{(14)}

Unconditional admission makes h∈RG1(C1)h \in R_{G_1}(C_1), violating Eq. (5). Zero is not an exceptionally short measurement; the compatible establishment did not occur.

A Class of Histories, Not One Exception

The ordinary establishment point is below the bailout. The relevant class includes histories reaching the consumer while missing that point [29]. Review must ask which newly reachable histories possess measurement state, rather than only which individual function appears to omit initialization.

Why Symmetric Entry Is Insufficient

Timestamping every idle-task entry would appear to pair entry with switch-out. But the correction identifies find_proxy_task() and force-idling as cases where idle-task selection need not establish the ordinary measurement interval [10, 20]. Thus

idle task selected⇏compatible S.(15)\text{idle task selected} \not\Rightarrow\text{compatible } S. \tag*{(15)}

This is a semantic distinction, not a new claim about security, physical core residency, cache behavior, or energy consumption.

Preserving Coverage While Refining Validity

The final correction retains the broader consumer and filters sampling:

void update_rq_avg_idle(struct rq *rq) {
    u64 idle_stamp = rq->idle_stamp;
    u64 delta, max;
    if (!idle_stamp)
        return;
    delta = rq_clock(rq) - idle_stamp;
    update_avg(&rq->avg_idle, delta);
    max = 2 * rq->max_idle_balance_cost;
    if (rq->avg_idle > max)
        rq->avg_idle = max;
    rq->idle_stamp = 0;
}

Listing 5: Essential structure of the correction.

The concrete admission predicate is

Gimpl(h):idle_stamp(h)≠0.(16)G_{\mathrm{impl}}(h) : \mathrm{idle\_stamp}(h) \ne0. \tag*{(16)}

It excludes the observed zero-timestamp histories. It is not a general proof that every nonzero timestamp is compatible under all scheduler changes. In the pinned core/fair source, the ordinary nonzero assignment is in new-idle balancing; initialization, successful pulling, and helper completion reset the field. A history that misses the assignment after one of those resets therefore reaches sampling with zero. This supports the demonstrated failure class while leaving future changes subject to provenance and ordering review. The site stays broad; admitted sampling histories become narrower.

The timestamp also has placement readers: fair.c 8482–8491 uses recent idle entry as a tie-breaker among CPUs already checked as available. Changing its reset point can change the lifetime seen by those readers. We identify this additional audit obligation but do not claim a measured placement effect. A stale comment mentioning avg_idle in select_idle_cpu() is not treated as an active dependency: the inspected body instead uses the SIS_UTIL scan budget [16].

The correction commit records reviews from K. Prateek Nayak and Vincent Guittot and an acknowledgment from John Stultz. Zhan Xusheng additionally supplied a Reviewed-by in the discussion; that tag is not listed in the merged-commit trailers [6, 10, 14, 29]. Both changes are available in the public Linux mainline repository. The commit records establish implementation and authorship, but this paper does not infer first-containing release tags or stable commit timestamps [13, 14].

Figure 2 distinguishes the three actual upstream implementation states: guarded but incomplete, broader but admitting missing-establishment samples, and broader with validity filtering. The final guard does not undo the original coverage intervention.

Cross-Case Analysis of Scheduler State Lifetimes

Two independent cases test whether the lifetime questions coherently describe other scheduler failures. This retrospective analysis demonstrates applicability, not predictive accuracy or automated bug finding.

Premature PELT Synchronization

The PELT correction states that fair scheduling synchronized its idle clock when pick_next_task_fair() failed to select a task, before the previous scheduling class could update required signals. RT-runqueue util_avg was affected [7]. Define SPELTS_{\mathrm{PELT}} as the previous-class update and CPELTC_{\mathrm{PELT}} as update_idle_rq_clock_pelt(). The old ordering was CPELT≺SPELTC_{\mathrm{PELT}} \prec S_{\mathrm{PELT}}; the repair moved synchronization to set_next_task_idle() after previous-class processing. The source credits Samuel Wu and Alex Hoh with reporting/testing, Vincent Guittot with authorship, and Peter Zijlstra with committing [7]. This is H2.

Stale CPU Utilization at Schedutil

util_est supplements PELT for utilization tracking [1]. During enqueue, update_load_avg() could indirectly notify schedutil before util_est_enqueue() made CPU utilization current. The correction moved that estimate update earlier in enqueue_task_fair() [2].

A complementary dequeue correction addressed CPU utilization being used for frequency selection before its update [27]. The ordering was

Sold≺CDVFS≺SCPU,current.(17)S_{\mathrm{old}} \prec C_{\mathrm{DVFS}} \prec S_{\mathrm{CPU,current}}. \tag*{(17)}

The repair separated CPU and task updates: CPU state moves before the notification path, whereas task state remains later because it depends on updated task util_avg. Initialized state was nevertheless stale for the triggering event. This is H3, not a new measurement of frequency or energy effects.

CaseRequired stateViolationRepair
avg_idleTimestamp for the intended idle interval.Sampling occurs without measurement establishment (H1).Keep switch-out accounting; reject zero timestamps.
PELTPrevious-class PELT signals updated before idle synchronization.Synchronization precedes the required update (H2).Move synchronization after previous-class processing.
util_est/schedutilCPU estimate current for enqueue or dequeue.Frequency-policy observation sees an older estimate (H3).Update CPU estimate before notification; retain task update at its dependency-correct point.

Table 4. Retrospective mapping to the lifetime audit.

Operational Lessons

Semantic Lifetime Is Not Source Proximity

The main case distinguishes task-state transitions from measurement boundaries. PELT distinguishes entering idle from completing the previous class’s updates. util_est distinguishes two estimates manipulated together but subject to different dependencies. Locally plausible source placement is not sufficient to establish compatibility.

Search Activity Is Not Search Utility

The independent results show several-fold increases in SMT and MC attempts with more modest changes in success fractions, and decreases at PKG and NUMA. Additional balancing is not automatically beneficial. The data show sensitivity and topology dependence, not a causal allocation of throughput effects to individual invalid samples.

A Review Checklist

For each stateful policy consumer:

  1. Identify the event, interval, or history the state should represent.

  2. Enumerate histories reaching the consumer, including those added by relocation.

  3. Locate compatible establishment or update for each admitted history.

  4. Check missing establishment, premature consumption, and stale reuse.

  5. Determine what the implementation guard excludes and what semantic obligations remain.

This checklist complements testing, race analysis, and verification; it does not replace them. The avg_idle path affects topology search, while the util_est path reaches frequency policy. Neither control dependency alone establishes an application-level, energy, or hardware benefit.

Evidence Boundaries

Table 5 distinguishes the conclusions supported by each evidence source and the remaining attribution limits.

EvidenceSupported conclusionBoundary
Original Ampere patch testsConfiguration-specific hackbench improvement and schbench tail-latency observations.No general benefit or isolated effect of the later guard.
Independent AMD reviewTopology-dependent balancing activity and tbench sensitivity.No per-sample causal attribution to application throughput.
Temporary tracing and source orderingZero-timestamp consumption is reachable; the bailout precedes establishment.A zero count alone does not identify the triggering path.
Merged helper refinementThe nonzero guard rejects demonstrated missing-establishment samples.Nonzero alone is not a universal proof of semantic compatibility.
Proposed three-variant experimentDefines how coverage and invalid-sample effects could be separated.Not executed or reported as results in this manuscript.

Table 5. Evidence supports distinct conclusions. Historical observations are not substituted for the unperformed controlled comparison.

Performance attribution. The historical tests are not a controlled three-variant experiment. Patch-submission hackbench/schbench observations and independent AMD results have distinct provenance. Neither is recast as a new experiment. The 7.2% result lacks raw values, commands, trial counts, and an explicit percentage definition in the cited commit record; this paper reports it as stated rather than converting it into a new throughput measurement. The AMD profile is one reported comparison and does not establish a distribution across machines or runs. No individual sample is mapped to a particular migration, cache event, or application latency.

Guard sufficiency. The zero guard excludes demonstrated missing-establishment histories. Full compatibility additionally requires reasoning about nonzero state’s provenance, ordering, and freshness.

Cross-case scope. PELT and util_est are retrospective source analyses, not new reproductions. The taxonomy is non-exhaustive and has no measured precision or recall. Synchronization, races, atomicity, representation, arithmetic, and multi-variable consistency can introduce other failures. Compat is a manual review obligation, not an automated implementation.

Related Work

Multicore scheduling and placement. Lozi et al. analyze Linux balancing and placement inefficiencies [17]. Arachne emphasizes core-aware thread management [25]; Shenango and Shinjuku explore low-latency scheduling and allocation for server workloads [8, 22]. The present case concerns the semantic validity of historical state consumed by kernel balancing policy.

Feedback and estimates. Feedback-driven CPU allocation and dependency-sensitive scheduling illustrate measurements guiding resource policy [26, 30]. Linux util_est adds an estimate on top of PELT [1]; its corrections show why updates must precede downstream policy observation [2, 27].

Verification and instrumentation. Coccinelle documents and automates collateral kernel changes [23]; longitudinal fault studies and system-specific checking provide broader bug-analysis methods [4, 24]. seL4 and CertiKOS establish stronger verified-kernel guarantees [5, 15]. DTrace and KernInst provide kernel instrumentation [3, 19], while Aragog addresses runtime verification of networked systems [28]. Our contribution is narrower: an operational intervention and a semantic audit abstraction for stateful policy refactorings, not a new checker.

Conclusion

Modern operating system schedulers increasingly depend on historical heuristics to navigate complex multicore and NUMA topologies. When such signals govern software control paths over hardware resources, their measurement validity becomes integral to policy correctness.

This paper presented the operational lifecycle of a targeted architectural redesign in the Linux scheduler. By introducing update_rq_avg_idle() and relocating accounting from wakeup-specific paths to put_prev_task_idle(), the upstream kernel closed a longstanding coverage defect that overlooked task arrivals from fork/clone, execve, and load-balancing migrations. Mainline deployment, however, exposed a subtle state-lifetime hazard: decoupling consumption from wakeups permitted ttwu_pending bails to reach switch-out with an uninitialized timestamp, injecting raw uptime into the estimator and saturating avg_idle. The subsequent mainline correction (commit c6dcd97c8be75) hardened this interface by restoring an explicit validity guard, preserving universal idle-exit coverage while rejecting invalid samples.

The fundamental operational lesson is that control flow symmetry does not imply measurement-lifetime symmetry. Mechanically pairing idle-task entry and exit hooks fails in modern operating systems because mechanisms such as SMT Core Scheduling force-idling and proxy execution dispatch the idle thread for isolation or locking reasons without establishing a genuine physical idle interval. Stateful policy inputs must therefore be audited not merely for syntactic reachability, but for semantic epoch compatibility. As demonstrated by our retrospective analysis of PELT idle-clock synchronization and util_est/schedutil frequency selection, the hazards of missing establishment (H1H_1), premature observation (H2H_2), and stale consumption (H3H_3) represent recurrent failure modes across scheduler and DVFS boundaries.

While isolating the granular microarchitectural performance consequences across historical kernel revisions remains an important area for controlled three-variant experimentation, the hardened switch-out architecture provides an immediate, robust foundation for production Linux load balancing. Looking forward, we believe the state-lifetime criteria formalized in this study can be operationalized into automated static analysis passes (e.g., via Coccinelle or compiler-level typestate checkers), helping systems programmers verify that kernel heuristics observe semantically valid state before guiding critical placement and power decisions.

References

  1. [1]Patrick Bellasi. sched/fair: Add util_est on top of PELT. Linux kernel development. Source record, March 2018.
  2. [2]Patrick Bellasi. sched/fair: Update util_est before updating schedutil. Linux kernel commit. Source record, May 2018. Commit 2539fc82aa9b07d968cf9bafffeec3e0416ac721.
  3. [3]Bryan M. Cantrill, Michael W. Shapiro, and Adam H. Leventhal. Dynamic Instrumentation of Production Systems. In 2004 USENIX Annual Technical Conference (USENIX ATC 04), pages 15–28. USENIX Association, 2004. Publisher version.
  4. [4]Dawson R. Engler, Benjamin Chelf, Andy Chou, and Seth H., allem. Checking System Rules Using System-Specific, Programmer-Written Compiler Extensions. In 4th Symposium on Operating Systems Design and Implementation (OSDI 00), pages 1–16. USENIX Association, 2000. Publisher version.
  5. [5]Ronghui Gu, Zhong Shao, Hao Chen, Xiong nan Wu, J ieung Kim, Vilhelm Sjöberg, and David Costanzo. CertiKOS: An Extensible Architecture for Building Certified Concurrent OS Kernels. In 12th USENIX Symposium on Operating Systems Design and Implementation (OSDI 16), pages 653–669. USENIX Association, 2016. Publisher version.DOI
  6. [6]Vincent Guittot. Re: [PATCH v3] sched/core: Skip rq→avg_idle update without a valid idle_stamp. Linux Kernel Mailing List. Source record, August 2026. August 18; Reviewed-by.
  7. [7]Vincent Guittot. sched/fair: Fix pelt clock sync when entering idle. Linux kernel commit. Source record, January 2026. Commit 98c88dc8a1ace642d9021b103b28cba7b51e3abc; fixes 17e3e88ed0b6.
  8. [8]Kostis Kaffes, Timothy Chong, Jack Tigar Humphries, Adam Belay, David Mazieres, and Christos Kozyrakis. Shinjuku: Preemptive Scheduling for Microsecond-scale Tail Latency. In 16th USENIX Symposium on Networked Systems Design and Implementation (NSDI 19), pages 345–360. USENIX Association, 2019. Publisher version.
  9. [9]Shubhang Kaushik. Idle-time accounting series: revision history through v8. Linux Kernel Mailing List. Series and revision history, January 2026. January 21; includes links to the 2025 v1–v7 submissions.
  10. [10]Shubhang Kaushik. [PATCH v3] sched/core: Skip rq→avg_idle update without a valid idle_stamp. Linux Kernel Mailing List. Source record, August 2026. August 7; includes reported temporary tracing and workload comparison.
  11. [11]Shubhang Kaushik. [PATCH v8] sched: update rq→avg_idle when a task is moved to an idle CPU. Linux Kernel Mailing List. Source record, January 2026. January 21; original helper introduction and accounting relocation.
  12. [12]Shubhang Kaushik. Re: [PATCH v3] sched/core: Skip rq→avg_idle update without a valid idle_stamp. Linux Kernel Mailing List. Source record, August 2026. August 17; repeated hackbench thread and process cases.
  13. [13]Shubhang Kaushik. sched: Update rq→avg_idle when a task is moved to an idle CPU. Linux mainline commit. Commit record, January 2026. Commit 4b603f1551a73e2868b9e7a14b3938e23275cefb; committed January 22 by Peter Zijlstra.
  14. [14]Shubhang Kaushik. sched/core: Skip rq→avg_idle update without a valid idle_stamp. Linux mainline commit. Commit record, September 2026. Commit c6dcd97c8be75f052a1ca52cf79b03e7292962f1; committed September 2 by Peter Zijlstra.
  15. [15]Gerwin Klein, Kevin Elphinstone, Gernot Heiser, June Andronick, David Cock, Philip Derrin, Dhammika Elkaduwe, Kai Engelhardt, Rafal Kolanski, Michael Norris, Thomas Sewell, Harvey Tuch, and Simon Winwood. seL4: Formal Verification of an OS Kernel. In Proceedings of the ACM SIGOPS 22nd Symposium on Operating Systems Principles (SOSP ’09), pages 207–220. Association for Computing Machinery, 2009. Publisher version.
  16. [16]Linux Kernel Contributors. Linux scheduler source at the idle-time validity correction. Linux main-line source snapshot, September 2026. Revision c6dcd97c8be75f052a1ca52cf79b03e7292962f1; kernel/sched/core.c, fair.c, idle.c, and sched.h. Source snapshot.
  17. [17]Jean-Pierre Lozi, Baptiste Lepers, Justin Funston, Fabien Gaud, Vivien Quéma, and Alexandra Fedorova. The Linux Scheduler: A Decade of Wasted Cores. In Proceedings of the Eleventh European Conference on Computer Systems (EuroSys ’16), pages 1–16. Association for Computing Machinery, 2016. Publisher version.DOI
  18. [18]Masahito S. [PATCH v2] sched/idle: Fix avg_idle saturation by establishing symmetric idle entry hook. Linux Kernel Mailing List. Source record, April 2026. Independent proposal and saturation analysis.
  19. [19]Barton P. Miller and Ariel Tamches. Fine-Grained Dynamic Instrumentation of Commodity Operating System Kernels. In 3rd Symposium on Operating Systems Design and Implementation (OSDI 99), pages 117–130. USENIX Association, 1999. Publisher version.DOI
  20. [20]K. Prateek Nayak. Re: [PATCH v2] sched/idle: Fix avg_idle saturation by establishing symmetric idle entry hook. Linux Kernel Mailing List. Source record, April 2026. April 23; review of symmetric-entry accounting.
  21. [21]K. Prateek Nayak. Re: [PATCH v8] sched: update rq→avg_idle when a task is moved to an idle CPU. Linux Kernel Mailing List. Source record, January 2026. January 22; independent bench results and attached scheduler statistics.
  22. [22]Amy Ousterhout, Joshua Fried, Jonathan Behrens, Adam Belay, and Hari Balakrishnan. Shenango: Achieving High CPU Utilization for Latency-Sensitive Datacenter Workloads. In 16th USENIX Symposium on Networked Systems Design and Implementation (NSDI ’19), pages 505–520. USENIX Association, 2019. Publisher version.
  23. [23]Yoann Padioleau, Julia L. Lawall, René Rydhof Hansen, and Gilles Muller. Documenting and Automating Collateral Evolutions in Linux Device Drivers. In Proceedings of the 3rd ACM SIGOPS/EuroSys European Conference on Computer Systems (EuroSys ’08), pages 247–260, 2008. Publisher version.
  24. [24]Nicolas Palix, Gaël Thomas, Suman Saha, Christophe Calvès, Julia L. Lawall, and Gilles Muller. Faults in Linux: Ten Years Later. In Proceedings of the Sixteenth International Conference on Architectural Support for Programming Languages and Operating Systems (ASPLOS ’11), pages 305–318. Association for Computing Machinery, 2011. Publisher version.
  25. [25]Henry Qin, Qian Li, Jacqueline Speiser, Peter Kraft, and John Ousterhout. Arachne: Core-Aware Thread Management. In 13th USENIX Symposium on Operating Systems Design and Implementation (OSDI 18), pages 145–160. USENIX Association, 2018. Publisher version.DOI
  26. [26]David C. Steere, Ashvin Goel, Joshua Gruenberg, Dylan McNamee, Calton Pu, and Jonathan Walpole. A Feedback-Driven Proportion Allocator for Real-Rate Scheduling. In 3rd Symposium on Operating Systems Design and Implementation (OSDI 99), pages 145–158. USENIX Association, 1999. Publisher version.
  27. [27]Xuewen Yan. sched/fair: Avoid stale CPU util_est value for schedutil in task dequeue. Linux kernel commit. Source record, January 2021. Commit 8c1f560c1ea3f19e22ba356f62680d9d449c9ec2.
  28. [28]Nofel Yaseen, Behnaz Arzani, Ryan Beckett, Selim Ciraci, and Vincent Liu. Aragog: Scalable Runtime Verification of Shardable Networked Systems. In 14th USENIX Symposium on Operating Systems Design and Implementation (OSDI 20), pages 701–718. USENIX Association, 2020. Publisher version.
  29. [29]Xusheng Zhan. Re: [PATCH v3] sched/core: Skip rq→avg_idle update without a valid idle_stamp. Linux Kernel Mailing List. Source record, September 2026. September 1; timestamp lifecycle and saturation analysis.
  30. [30]Haoqiang Zheng and Jason Nieh. SWAP: A Scheduler with Automatic Process Dependency Detection. In First Symposium on Networked Systems Design and Implementation (NSDI 04). USENIX Association, 2004. Publisher version.

Paper details

vlnc:W_xf2enyk9
Version
v1 · latest
Published
Fresh — added to the Hub within the last 30 days
Added
License
CC BY 4.0
Usage

views · 9

downloads · 0

A view counts once per browser per day, a download each time the PDF is requested.

  • Computer Science

Not recorded for this paper

View statement
Looking for related papers…
Contents