High System CPU Usage Linux: Diagnose Before You Fix

High System CPU Usage Linux: Diagnose Before You Fix

An alert arrives with CPU system time rising and requests timing out. Capture a bounded diagnostic sample when operationally safe, before a restart clears useful counters. An approved mitigation may still take priority; record its time and preserve available evidence. A restart does not establish or remove the underlying cause.

High system CPU means time accounted to kernel execution. Interrupt handling, I/O wait and virtual-machine steal are related diagnostic signals with different meanings; idle/waiting time is not busy kernel time. Inspect the fields separately and use the definition of the specific tool.

What follows stays on the kernel side. User-space CPU, tool selection and long-term measurement belong to a separate guide. This is the drilldown for when %sys, %soft, %irq, %iowait or %steal is the number that moved.

Table of Contents

Why System CPU Needs Its Own Diagnosis

In mpstat, %sys measures kernel execution and explicitly excludes the separately reported %irq and %soft interrupt time. Other tools may group fields differently. A high value does not name the responsible process, syscall or device.

%usr is user-mode execution; %sys, %irq and %soft account for different forms of kernel work in mpstat. %iowait is an imperfect idle/I/O accounting measure, not CPU consumed by storage. %steal records involuntary virtual-CPU wait while the hypervisor services other virtual processors; it does not identify a tenant.

Load average counts runnable and uninterruptible tasks through smoothed time averages, not CPU utilization. A value of 4 on four logical CPUs is not proof of full CPU use: blocked tasks, affinity, quotas and changing workload all matter. The vmstat manual distinguishes runnable/blocked task counts, CPU percentages and the initial since-boot report.

Scaling hides the same thing in the other direction. One saturated core out of sixteen barely shifts a host-wide average, yet that core is the ceiling for a single-threaded service pinned to it.

This article covers kernel and system CPU diagnosis only. For general CPU measurement, tool choice and historical context, the guide to monitoring CPU usage in Linux is the right starting point, and none of it is repeated here.

First record which state rose, the affected service and UTC time. Capture evidence when safe, while following the incident runbook for any urgent mitigation.

Sample a 60-Second Window Before You Judge

A single top snapshot is a photograph of a moving target. Capture a time series instead, on the slow host, while it is still slow. A practical guide to performance baselines is useful for deciding what normal looks like before you compare the spike against it. For this pass, the point is simpler: sample long enough to see whether the state is sustained, where it lands, and which counters move with it.

The 60-second window below is an illustrative starting point, not a universal minimum or a profiling rule from a load-average article. Short bursts and longer trends may require different windows. Compare CPU fields with run-queue pressure, context switches, I/O and per-CPU values over overlapping timestamps.

Run the ordered sequence

Run these bounded observations concurrently in Bash so their intervals overlap. vmstat comes from procps/procps-ng; mpstat, pidstat and iostat come from sysstat. Check installed versions and local options first. The files may contain process details, so keep the directory private.

umask 077
sample_dir=$(mktemp -d /tmp/cpu-sample.XXXXXX) || exit 1
date -u '+%Y-%m-%dT%H:%M:%SZ' > "$sample_dir/start-utc.txt"
LC_ALL=C vmstat 1 61 > "$sample_dir/vmstat.txt" 2>&1 & p1=$!
LC_ALL=C mpstat -P ALL 1 60 > "$sample_dir/mpstat.txt" 2>&1 & p2=$!
LC_ALL=C pidstat -u -w 1 60 > "$sample_dir/pidstat.txt" 2>&1 & p3=$!
LC_ALL=C iostat -y -xz 1 60 > "$sample_dir/iostat.txt" 2>&1 & p4=$!
for child in "$p1" "$p2" "$p3" "$p4"; do
  if wait "$child"; then result=0; else result=$?; fi
  printf '%s exit=%s\n' "$child" "$result" >> "$sample_dir/results.txt"
done
date -u '+%Y-%m-%dT%H:%M:%SZ' > "$sample_dir/end-utc.txt"
printf 'Evidence: %s\n' "$sample_dir"

Discard vmstat's first since-boot row; the next 60 rows are interval observations. iostat -y suppresses its initial since-boot report. pidstat reports per-process CPU and context switches, not a guaranteed ranking of the busiest processes. Compare timestamps and failed-command results before interpreting missing rows. These tools read counters but still consume resources; record any monitoring overhead.

Permissions and what each command can see

System-wide counters are often readable by an ordinary user. Access to other processes depends on permissions, procfs mount restrictions and namespaces; root is not universally required, nor does using root make every action harmless. Request only the visibility needed, and record unavailable fields rather than treating them as zero. Changing perf_event_paranoid is a separate security decision.

Permission rule: if pidstat shows nothing busy during a high %sys window, that isn't evidence of no workload. It may be a visibility problem, a kernel thread, or interrupt context.

The same caution applies to %iowait and %steal. %iowait says CPUs were idle while I/O was outstanding, but it cannot separate a healthy queue from a struggling device without iostat and process state. %steal can only be observed inside the guest as time the hypervisor gave elsewhere, so the guest cannot identify the noisy neighbour from these counters alone.

Read the shape, not the peak

A short spike can matter if it aligns with user-visible latency. Sustained values describe a different pattern. Correlate both with the incident timeline: device latency for I/O wait, per-core distribution for interrupts, process visibility for kernel work, and hypervisor context for steal.

If tools are unavailable, interval deltas from /proc/stat can help, but do not sum all fields blindly. Sum user, nice, system, idle, iowait, irq, softirq and steal; guest and guest_nice are already included in user/nice and must not be counted again. The kernel proc documentation and proc_stat manual describe these counters and USER_HZ units (sysconf(_SC_CLK_TCK)). Reject nonpositive total deltas or negative/reset counters; iowait itself can decrease and is not reliable as a standalone measure. Record reboot, CPU hotplug and collection changes.

Save the outputs with their timestamps. Later checks should use this window as the reference point, so the same slowdown can be matched against kernel work, per-core pressure and real process behaviour.

Read Each CPU State as a Separate Signal

A high %sys line at the top of top proves only that the kernel accounted time to system work. It does not identify the syscall, driver, filesystem or network path responsible. Treat %usr, %sys, %iowait, %soft, %irq and %steal as separate signals, each with its own next check and its own blind spot. That habit keeps a storage wait, a softirq burst and guest steal from being collapsed into one vague "CPU is busy" story. It also matches the practical failure mode described in why your server feels slow when top shows 50% idle, where headline idle time hides a narrower bottleneck.

Match each state to its next check

Observed state What it indicates What it cannot establish Next read-only check
%usr high User-space code is consuming CPU Whether that code is needed, or which function is hot pidstat -u 1 60 to find the PID, then a targeted profile
%sys high Kernel work for syscalls, filesystem, network or drivers Which syscall or driver is responsible A bounded profile of an approved target, after collecting basic counters
%soft or %irq high Interrupt or softirq handling, often network or device queues Whether one queue or one core is overloaded mpstat -P ALL 1 60 for per-core values, compared with /proc/interrupts over time
%iowait high CPUs idle while tasks wait on I/O That storage is slow on its own iostat -y -xz 1 60 for await and device utilization, then process state
%steal high (virtual machine) Involuntary virtual-CPU wait accounted by the hypervisor Which tenant or host caused it Record steal and workload trends; seek host-side evidence from the provider
Load high with %idle high Runnable/uninterruptible task counts need per-core, quota and I/O context That CPUs are saturated Check /proc/pressure/io and look for processes in state D with ps
One core near 100%, average low Concentrated work, possibly a thread or interrupt path That the application is single-threaded or the cause is known mpstat -P ALL 1 60 and pidstat -t to find the hot thread

For an illustrative interval with 10% user, 3% system, 5% iowait and 82% idle, CPU execution accounts for 13%, while I/O wait is separate. It would be incorrect to claim the host spent more time waiting on I/O than executing code. Always compare fields with the same interval and denominator.

One fully busy logical CPU out of 16 contributes 100 / 16 = 6.25% to an aggregate utilization percentage, assuming the other CPUs are idle. That arithmetic does not imply equal physical throughput across cores, SMT siblings or changing CPU frequencies. Inspect the individual CPUs and workload affinity.

On a virtual machine, steal deserves its own line. The mpstat manual defines %steal as time the virtual CPU waited involuntarily while the hypervisor serviced another virtual processor. A guest can look unwell while its own processes are consuming nothing unusual. The guest cannot directly change the host scheduler, but reducing demand or shifting workload may mitigate impact while host-side causes are investigated.

A counter reports what the kernel accounted for. It never reports intent.

Two measurement caveats keep this honest. iostat reports CPU percentages as system-wide averages across all processors, and mpstat interval rows are averages for the period they cover. Aggregate comfort and per-core saturation coexist routinely. Write down which states rose, in which window, and on which cores. Then test them in order: pressure, I/O state, kernel stack.

Check Whether CPU Is Really Scarce

A busy kernel can still have spare capacity. The practical question is whether tasks are waiting for CPU, storage or a quota, and the fastest checks are read-only. Start with pressure, then compare that with the workload's own accounting. That keeps %sys from being mistaken for starvation on its own.

A male IT professional focused on his laptop screen while configuring servers in a data center environment.

Where available, read /proc/pressure/cpu and /proc/pressure/io. The kernel PSI documentation defines some/full, time-averaged stall percentages and cumulative total in microseconds. Compare deltas of total across timestamps to quantify stalls during an interval; a large lifetime total is not a current spike. Pollable PSI triggers require explicit thresholds and windows. System-wide CPU full has special compatibility semantics; use the documented CPU some signal for host-level CPU pressure.

For a systemd service on a cgroup v2 host, discover the actual control-group path; it is not always under system.slice. Replace example.service with the approved unit:

unit=example.service
cg=$(systemctl show --property=ControlGroup --value "$unit") || exit 1
case "$cg" in /*) ;; *) printf 'No control group found\n' >&2; exit 1;; esac
for field in cpu.stat cpu.max cpuset.cpus.effective cpu.pressure; do
  printf '\n%s\n' "$field"
  cat "/sys/fs/cgroup${cg}/$field"
done

Repeat the readings across a known interval and check applicable ancestor quotas and CPU sets. The cgroup v2 documentation defines cpu.max bandwidth and throttling counters. For example, 50000 100000 permits 0.5 logical CPU of aggregate runtime per period, not 50% of an eight-CPU host. Rising throttling counters with spare host CPU support investigating a quota; they do not prove which setting should change. Pressure without local throttling may reflect affinity, ancestor limits or competing work. The load-average guide provides additional context.

The video walkthrough below covers how those pressure readings behave in practice.

Utilization is an accounting ratio, not a direct percentage of maximum application throughput. Frequency scaling, SMT, memory stalls and workload mix prevent a universal conversion from 50% CPU to a fixed remaining capacity. Use a representative load test and latency/throughput measurements when assessing headroom.

A missing cgroup or PSI file can reflect the wrong path, namespace, permissions, controller state, kernel configuration or version. Diagnose those conditions before interpreting absence. Preserve available process and run-queue evidence. Pressure establishes that tasks waited; it does not identify the process responsible.

Trace Kernel Work and Hot Functions Safely

Sampling answers one question well: where CPU time accumulates inside the kernel or inside one process. It doesn't answer why, and it won't fix anything by itself.

Sample first, interpret second

Confirm the current PID, its start time and the scope of the approved diagnostic. Sampling changes observation overhead and writes a profile; keep it bounded and protect the data. The following is a documented Linux example, not a production test. Substitute a verified PID:

pid=12345
umask 077
profile_dir=$(mktemp -d /tmp/cpu-profile.XXXXXX) || exit 1
sudo perf record -o "$profile_dir/perf.data" -F 49 -g -p "$pid" -- sleep 15
sudo perf report -i "$profile_dir/perf.data" --stdio
# Optional separate bounded counter measurement, when supported:
sudo perf stat -p "$pid" -e cycles,instructions,context-switches,cpu-migrations,cache-misses -- sleep 15

The perf record manual documents the PID target, frequency and output options; perf stat documents counter measurements. Check command exit status and unsupported/multiplexed events before using the output. A targeted process profile can miss unrelated interrupt or kernel-thread work. Broader profiling needs its own approved scope; do not silently default to all CPUs.

Access depends on kernel policy, capabilities and target. Do not relax perf_event_paranoid just to make a command succeed. Missing symbols, stack-unwinding limitations, PID reuse and short windows can distort interpretation. Read self and descendant time with the report's actual denominator. Samples show where execution landed, not the cause or intent.

With pidstat's normal per-process CPU convention, 100% corresponds to one logical CPU and multithreaded processes may exceed it; normalization options can change that denominator. This is different from a host-wide percentage. Validate a proposed change with comparable workload and service latency, retain before/after evidence and use the bottleneck investigation workflow for wider dependencies.

Decide on a Fix Only After the Evidence Agrees

Preserve available evidence before a planned change when operationally safe: the 60-second samples, the perf output, the pressure and cgroup readings, all timestamped with host and versions from uname -r and mpstat -V. Then match the fix to the confirmed cause, not to the symptom.

A checklist clipboard titled Decide on a Fix Only After the Evidence Agrees for debugging Linux systems.

  • Throttling against low host CPU: raise the quota in a staged change, record the previous value first, and roll back if pressure doesn't fall.
  • %iowait confirmed by device await and queue depth: move to storage diagnosis. The explanation of disk queue length shows what to compare before blaming the disk itself.
  • High %steal: take the samples to the hosting provider. Guest-side demand reduction may mitigate symptoms; host scheduling still needs provider-side evidence.
  • One hot function or one hot process: make the code or configuration change in staging first, then roll it out while watching the same metric that flagged the problem.

Do not restart solely to make a graph look healthy. If the runbook calls for an urgent restart or workload reduction, use the approved scope and rollback, record the timestamp and retain evidence first when safe. A restart can reset useful counters, but neither recurrence nor its timing is guaranteed.

A production mitigation needs a defined scope, validation and recovery plan appropriate to its impact; a one-command rollback is not always possible or sufficient.

For ongoing visibility, connect one Linux host to Fivenines Linux server monitoring. The open-source agent sends CPU, memory, swap, load, disk I/O, partitions, mountpoints, network counters and interfaces, and top process names by resource use, on a default 60-second interval. Compare those readings against the manual sample captured during the incident, then test one alert on a non-production resource. A 60-second collection interval won't reproduce sub-second spikes that a one-second mpstat sample caught, so keep the manual sequence for those.


Fivenines provides hosted Linux CPU, load, memory and process context for ongoing observation. Verify which CPU-state breakdowns and alert fields are actually exposed in your agent and plan; do not assume separate %sys, %iowait or %steal alerts. Connect one host, compare the available readings with a timestamped manual sample, and test a supported alert. Use Fivenines for historical context and retain higher-resolution diagnostics for short incidents.

Read more