Resolving an Idle-Time Accounting Hazard in Linux Load Balancing
Abstract
The Linux kernel scheduler uses per-runqueue idle-time history (avgidle) 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 updaterqavgidle() 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 ttwupending 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.
Create a lesson
Metadata
- Categories
- cs.OS, cs.DC
- Comments
- 11 pages, 3 figures, 5 tables. Operational case study of Linux scheduler idle-time accounting
Related papers
Deterministic Network Interface Naming on Multi-NIC Linux Systems: A Boot-Time Convergence Approach
Shared title terminologycs.OSChetan Nigudgi
Hotness Fragmentation Limits Linux Proactive Reclaim: An Experimental Study of Object Placement, zswap, and cgroup v2 memory.reclaim
Shared title terminologycs.OSLin Ju
Reproducer Synthesis for AI-Reported Bugs in the Linux Kernel
Shared title terminologycs.OSXiao Wu, Yunbo Ni, Hao Sun et al.
Bring Cloud-Native Networking to FreeBSD Jails: Porting Calico from Linux
Shared title terminologycs.OSSoma Sakaguchi, Shintaro Suzuki, Yuki Nakata et al.
Benchmarking Linux CGroup and Schedule Idle
Shared title terminologycs.OSAnna Arpaci-Dusseau
Restoring Fair Hrtick Re-arming After Same-Task Repicks in the Linux EEVDF Scheduler
Shared title terminologycs.OSShubhang Kaushik