Operations 7 min read

Understanding Linux Load Average: Run Queue, Calculation Method, and Interpretation

This article explains what Linux load average is, how the kernel’s run‑queue (including R and D state processes) is used to compute it via an exponential weighted moving average, and how to interpret the resulting metrics for system performance.

NetEase Game Operations Platform
NetEase Game Operations Platform
NetEase Game Operations Platform
Understanding Linux Load Average: Run Queue, Calculation Method, and Interpretation

In interviews the author often starts with the question “What is Linux loadavg and where does it come from?” The standard answer is that loadavg is the average number of processes in the run queue over specific time intervals, calculated by the kernel.

The run queue is a per‑CPU data structure that tracks two counters: nr_running (processes in R state, running or runnable) and nr_uninterruptible (processes in D state, usually I/O‑bound and cannot be interrupted). Both counters are included in the load‑average calculation.

Historically loadavg only counted R‑state processes, which caused misleadingly low values on I/O‑intensive systems. Modern Linux adds D‑state processes, calling the sum the “active” processes, to better reflect overall system load.

* Once every LOAD_FREQ:
*   nr_active = 0;
*   for_each_possible_cpu(cpu)
*     nr_active += cpu_of(cpu)->nr_running + cpu_of(cpu)->nr_uninterruptible;

The kernel does not simply average these samples; it uses an exponential weighted moving average (EWMA). Each new sample is given a larger weight than older ones, allowing the loadavg to react more quickly to recent load spikes while smoothing out short‑term fluctuations.

/*
 * a1 = a0 * e + a * (1 - e)
 * a2 = a1 * e + a * (1 - e)
 * ...
 * an = a0 * e^n + a * (1 - e^n)
 */

This weighting scheme means that if the number of active processes keeps increasing, the loadavg will rise faster than a simple arithmetic mean, giving a clearer indication of a system under sustained high load.

When interpreting loadavg values, dividing by the number of CPU cores and checking if the result is ≥ 1 can be a rough indicator, but because D‑state processes are included, the metric should be considered alongside other performance counters. There is no universal threshold; the significance of a given loadavg depends on the typical workload and hardware configuration.

References and further reading are provided via QR‑code images in the original article.

PerformancekernelLinuxexponential weighted moving averageload averagerun queue
NetEase Game Operations Platform
Written by

NetEase Game Operations Platform

The NetEase Game Automated Operations Platform delivers stable services for thousands of NetEase titles, focusing on efficient ops workflows, intelligent monitoring, and virtualization.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.