Conceptio › Archive › arXiv CS
arXiv CS open access

Resolving an Idle-Time Accounting Hazard in Linux Load Balancing

Shubhang Kaushik · arxiv_cs
arXiv CS · Papers
Open Source ↗Direct PDF ↓
kerneloperating-systemsvirtualization
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.
Conceptio Open Archive

Analyze & explore related research in Conceptio

Connect this record directly into your research workflow or AI agent. Explore citations across open repositories, query full text, and export structured proof bundles.

Resolving an Idle-Time Accounting Hazard in Linux Load Balancing

arXiv:2611.35429v1 [cs.OS] 26 Nov 2026

Shubhang Kaushik Ampere Computing shubhangpk@gmail.com

Abstract

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.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 newidle 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 approxi-

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 forceidling 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.

1

Introduction

Operating-system schedulers rely on state accumulated across execution events to guide resource allocation. In Linux, perrunqueue idle-time history participates in the cost decisions

1

mately 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 × 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.

For each history h, let Sh denote a relevant establishment event. Define semantically compatible histories as  RS (EC ) = h ∈ R(EC ) ∃Sh : Sh ≺h EC (4) ∧ Compat(Sh , EC , h) . 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 ).

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.

(1)

2.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.

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 ), 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.

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.

2

(5)

H2: Premature consumption. A required predecessor update U occurs too late: C ≺h U

instead of U ≺h C.

(6)

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

Operational Model and Review Questions

We model a stateful policy input as

M = (S,C, G),

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

(2)

where S establishes or updates state, C consumes it for a policy-relevant operation, and G is the implementation predicate admitting consumption. The consumer operation is distinct from its syntactic site EC . 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 ) be these histories reaching the site. The implementation admits consumption on RG (C) = {h ∈ R(EC ) | G(h, EC )}.

Sold ≺h C ≺h Se .

(7)

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

(3) 2

2.2

Consumer Relocation

can be abstracted as

Moving a site from EC0 to EC1 makes histories newly reachable: ∆R = R(EC1 ) \ R(EC0 ). (8) Admission additionally depends on G. Review must ask both whether the newly reached events should consume the measurement and whether each newly admitted consumption has compatible producer state.

3

Linux Scheduler Background

3.1

Scheduling Domains and Search Cost

(11)

4

Closing the Coverage Gap: Helper Introduction and Relocation

4.1

The Original Wakeup-Side Consumer

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; }

Measurement Interval and State Lifecycle

Listing 1: Simplified original accounting.

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

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.

Idle History and Search Termination

Linux tracks historical idle duration and new-idle balancing cost. Writing Ak for avg_idle, the exponentially weighted update is idealized without integer rounding as 7 1 Ak = Ak−1 + ∆idle . 8 8

AbortSearch ⇐ A < Cspent +Cd .

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

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 idletime 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. 3.3

(10)

These isolate avg_idle-dependent predicates, not the complete control flow, which also depends on eligibility, pending wakeups, and other conditions. Driving A 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].

Linux scheduling domains are platform- and configurationdependent 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. 3.2

TerminateSearch ⇐ A < Cd ,

(9) 4.3

Let Cd denote the relevant scheduling-domain new-idle cost and Cspent the cost already incurred. Relevant comparisons

Extracting the Helper and Moving the Boundary

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

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

State transition

Measurement 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 times- No continuing idle interval is submitted on tamp. this branch.

Idle-class switch-out (idle.c 483–488; core.c Guarded sample construction, estimator 3743–3758) update, clamp, timestamp reset.

Measurement start idle_stamp

Validity guard stamp != 0

Sample ∆ = Trq − S

Consume a represented interval once; otherwise skip sampling.

Estimator avg_idle

New-idle cost comparisons

Without the guard, S = 0 produces ∆ = Trq , not measured idle duration. A sufficiently large sample can drive the estimator to its clamp. 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.

static void put_prev_task_idle(struct rq *rq, ...) { update_curr_idle(rq); scx_update_idle(rq, false, true); update_rq_avg_idle(rq); }

5

Behavioral Evidence from Upstream Testing

5.1

Independent Scheduler Statistics

K. Prateek Nayak’s review reported no broad regression, but recurring tbench-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 tbench’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. 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.

Listing 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 switchout, 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].

4

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. Arrival class

Destination activation chain

Coverage condition and limit

Ordinary wakeup

ttwu_do_activate() → activate_task().

Reaches the original wakeup-side site; relocated accounting instead consumes at idle-class switch-out.

New task

wake_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 attachment

attach_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 migration sched_exec() selects another CPU; stopper migration can proceed through __migrate_task() → move_queued_task() → activate_task().

Original implementation Wakeup-side consumer. Nonzero timestamp guard. Some non-wakeup idle exits bypass accounting.

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.

Relocated implementation Idle-task switch-out consumer. Broader arrival-path coverage. Zero-timestamp histories can reach unguarded sampling.

Refined implementation Same switch-out consumer. Nonzero timestamp guard. Rejects the demonstrated missingmeasurement histories.

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

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

}

Listing 3: Simplified initial helper. Attempts Domain Before SMT MC PKG NUMA

5.2

Derived successes

After Before

3,964 17,961 1,917 7,022 43 13 21 4

189 56 1 1

With a zero timestamp,

After

∆bad = Trq .

1,011 218 0 1

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 A, sample T , and clamp M = 2max_idle_balance_cost, saturation occurs when 7A + T ≥ 8M. 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

For compatible establishment, ∆valid = Trq − Sidle .

(13)

(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;

6

Remaining Controlled Validation

The historical record establishes correctness reachability and behavioral sensitivity, but does not isolate the guard’s perfor5

mance 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.

7

Missing Establishment After Relocation

7.1

Independent Diagnosis and Runtime Reachability

1. New-idle entry Pending wakeup is already recorded. 2. Early return ttwu_pending bailout precedes the ordinary timestamp assignment. 3. Idle-task execution The runqueue can enter idle with a zero timestamp. 4. Pending wakeup processed Switch-out reaches the relocated helper. 5. Measurement boundary Unguarded: sample is Trq . Refined: zero timestamp skips sampling. 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.

7.2

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, h ∈ R(EC1 ),

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 followup 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.

h∈ / RS (EC1 ).

(14)

Unconditional admission makes h ∈ RG1 (C1 ), violating Eq. 5. Zero is not an exceptionally short measurement; the compatible establishment did not occur. 7.3

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.

6

7.4

Why Symmetric Entry Is Insufficient

The correction commit records reviews from K. Prateek Nayak and Vincent Guittot and an acknowledgment from John Stultz. Zhan Xusheng additionally supplied a Reviewedby in the discussion; that tag is not listed in the mergedcommit 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 backports from 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.

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 idletask selection need not establish the ordinary measurement interval [10, 20]. Thus idle task selected ̸⇒ compatible S.

(15)

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

8

Preserving Coverage While Refining Validity

9

The final correction retains the broader consumer and filters sampling:

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.

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; }

9.1

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 SPELT as the previous-class update and CPELT as update_idle_rq_clock_pelt(). The old ordering was CPELT ≺ SPELT ; 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.

Listing 5: Essential structure of the correction.

The concrete admission predicate is Gimpl (h) : idle_stamp(h) ̸= 0.

Cross-Case Analysis of Scheduler State Lifetimes

(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].

9.2

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)

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. 7

Table 4: Retrospective mapping to the lifetime audit. Case

Required state

Violation

Repair

avg_idle

Timestamp for the intended idle inter- Sampling occurs without measurement Keep switch-out accounting; reject val. establishment (H1). zero timestamps.

PELT

Previous-class PELT signals updated before idle synchronization.

Synchronization precedes the required Move synchronization after previousupdate (H2). class processing.

util_ est/schedutil

CPU estimate current for enqueue or dequeue.

Frequency-policy observation sees an Update CPU estimate before noolder estimate (H3). tification; retain task update at its dependency-correct point.

10

Operational Lessons

11

10.1

Semantic Lifetime Is Not Source Proximity

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

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. 10.2

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.

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. 10.3

Evidence Boundaries

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

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.

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.

12

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.

8

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

Supported conclusion

Boundary

Original Ampere patch tests

Configuration-specific hackbench improvement and schbench tail-latency observations.

No general benefit or isolated effect of the later guard.

Independent AMD review

Topology-dependent balancing activity and tbench sensitivity.

No per-sample causal attribution to application throughput.

Temporary tracing and source ordering

Zero-timestamp consumption is reachable; the bailout precedes establishment.

A zero count alone does not identify the triggering path.

Merged helper refinement

The nonzero guard rejects demonstrated missing-establishment samples.

Nonzero alone is not a universal proof of semantic compatibility.

Proposed three-variant experiment

Defines how coverage and invalid-sample effects could be separated.

Not executed or reported as results in this manuscript.

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].

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 (H1 ), premature observation (H2 ), and stale consumption (H3 ) 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.

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.

13

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,

References [1] Patrick Bellasi. sched/fair: Add util_est on top of PELT. Linux kernel development. Source record, March 2018. [2] Patrick Bellasi. sched/fair: Update util_est before updating schedutil. Linux kernel commit. Source record, May 2018. Commit 2539fc82aa9b07d968cf9ba1ffeec3e0416ac721.

9

[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.

[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.

[4] Dawson R. Engler, Benjamin Chelf, Andy Chou, and Seth Hallem. Checking System Rules Using SystemSpecific, Programmer-Written Compiler Extensions. In 4th Symposium on Operating Systems Design and Implementation (OSDI 00), pages 1–16. USENIX Association, 2000. Publisher version.

[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 4b603f1551a73e2868b9e7a14b3938c23275cefb; committed January 22 by Peter Zijlstra. [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.

[5] Ronghui Gu, Zhong Shao, Hao Chen, Xiongnan Wu, Jieung 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.

[15] Gerwin Klein, Kevin Elphinstone, Gernot Heiser, June Andronick, David Cock, Philip Derrin, Dhammika Elkaduwe, Kai Engelhardt, Rafal Kolanski, Michael Norrish, 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.

[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] Vincent Guittot. sched/fair: Fix pelt clock sync when entering idle. Linux kernel commit. Source record, January 2026. Commit 98c88dc8a1ace642d9021b103b28cba7b51e3abc; fixes 17e3e88ed0b6.

[16] Linux Kernel Contributors. Linux scheduler source at the idle-time validity correction. Linux mainline source snapshot, September 2026. Revision c6dcd97c8be75f052a1ca52cf79b03e7292962f1; kernel/sched/core.c, fair.c, idle.c, and sched.h. Source snapshot.

[8] Kostis Kaffes, Timothy Chong, Jack Tigar Humphries, Adam Belay, David Mazières, and Christos Kozyrakis. Shinjuku: Preemptive Scheduling for Microsecondscale Tail Latency. In 16th USENIX Symposium on Networked Systems Design and Implementation (NSDI 19), pages 345–360. USENIX Association, 2019. Publisher version.

[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.

[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.

[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.

[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.

[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.

[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.

10

[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.

[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] 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 tbench results and attached scheduler statistics.

[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.

[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.

[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.

[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] 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] 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. [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] Xuewen Yan. sched/fair: Avoid stale CPU util_est value for schedutil in task dequeue. Linux kernel commit. Source record, January 2021. Commit 8c1f560c1ea3f19e22ba356f62680d9d449c9ec2.

11

Related documents

Record · ID 1812341 · SHA-256 eb2491b5ccbd3dd2
Retrieved via Conceptio: every document is proof-bundled with source, license, and retrieval metadata.
Bring this data into your agent: Connect via MCP or API · 20 free credits to start · no card required
Read the Docs → · View CLI source on GitHub · Conceptio Open Knowledge Archive