﻿# Use effective cpusets when a container sees too many CPUs

Establish effective CPU eligibility, then inspect thread affinity and bandwidth quota as separate constraints.

Author: Retrivium editorial team
Updated: 2026-11-03
Canonical URL: https://retrivium.ai/journal/guide-linux-cpuset-effective/
Language: en

A container reports many logical CPUs, yet its worker can execute on only a subset. Hardware enumeration, cgroup cpusets, thread affinity and CPU bandwidth quota describe different boundaries. Use the effective cpuset to establish eligibility before assuming that every visible processor is available for feeding the model.

## Resolve the worker group

Find the target process's effective unified cgroup and its ancestors through authorized observations. Preserve the kernel, runtime and timestamp. A container-local path can hide part of the hierarchy. Do not compare a host CPU inventory with an unrelated child group's configuration and treat the mismatch as a scheduler fault.

## Read inherited eligibility

cpuset.cpus records a requested set, while cpuset.cpus.effective reports online CPUs actually granted by the parent. An empty requested set can inherit, so it does not prove an empty effective set. Parent restrictions and CPU hotplug can change eligibility independently of the stored request. Inspect the effective value at the time of the slow operation.

## Compare each thread's mask

A thread can have an additional affinity restriction within the administrative set. The observed runnable set follows the applicable intersection, not whichever list is widest. A policy request containing no permitted CPUs can fail. Preserve the actual mask and return status rather than assuming a command printed before startup established the configuration used by every worker.

## Keep quota separate

A cpuset answers where tasks may run. CPU bandwidth controls how much execution time the group receives over its configured periods. A worker can be eligible on several CPUs while a narrow quota throttles its total runtime. Conversely, a large quota does not grant access to CPUs excluded by cpuset. Diagnose eligibility and throttling with their own evidence.

## Validate a stable fixture

Use a disposable workload with a known inherited set, then compare requested, effective and thread masks without changing the host inventory. Acceptance means the observed execution boundary is explained by the hierarchy and affinity. It does not prove dedicated cores, immunity to interrupts, correct NUMA memory placement or enough host throughput for the model's actual request concurrency.

## Primary references

[Linux Control Group v2](https://docs.kernel.org/admin-guide/cgroup-v2.html).

[Linux Thread CPU Affinity](https://man7.org/linux/man-pages/man2/sched_setaffinity.2.html).

[Process Status](https://man7.org/linux/man-pages/man5/proc_pid_status.5.html).

Related reading: [Idle GPU, throttled CPU: diagnosing container CPU quota](/journal/cgroup-cpu-throttling-gpu-feeder/); [NUMA in GPU servers: why resource placement matters](/journal/numa-and-gpu-servers/).
