← Back to Pull requests

DRA: pin topology-aware containers to their claims #823

Closed
unknown closed this pull request without merging on Oct 15, 2026 11:41 UTC
View on GitHub
unknown unknown commented on Oct 01, 2026 15:22 UTC
Author

Pinning containers to their claims

Seventh PR of the DRA series, on top of #821. Three commits: the
topology-aware policy pins a container holding claims to the claims' CPUs, the
test42-dra-devices e2e test checks the pinning, and strict topology hints
no longer fail a container because of its claimed CPUs. Nothing in pkg/resmgr
changes.

What a claiming container runs on

A container holding claims runs on the CPUs of its claims. A container with no
CPU request of its own, the usual case, runs on its claims only. A container
with a CPU request also gets its normal allocation: exclusive CPUs, and shared
CPUs if it has a shared portion. A container with reserved CPUs, such as one
in kube-system, gets its reserved CPUs as well if it has a CPU request.

Hiding hyperthreads applies to the exclusive CPUs only. The claimed CPUs are
pinned as they are, since they are exactly what the claim asked for.

Strict topology hints apply to the container's own CPUs only. A claim is
allocated before its container exists, so its CPUs cannot follow the
container's hints. Failing the container for that would make strict hints
fail at random for containers with claims. If the claimed CPUs do not match a
strict hint, the policy logs a warning and allows them.

Where a claiming container goes

A claiming container with normal CPUs gets its grant from the pool of the
claimed CPUs, the same pool the claim grant itself came from, rather than from
the pool scoring would pick. So its memory comes from the claims' NUMA node,
and so do its own exclusive and shared CPUs.

A container with reserved CPUs stays in the root pool, like other reserved
containers, and its memory comes from there. The claim's pool usually has no
reserved CPUs, so the container would get normal CPUs there instead.

The CPU shares follow the rule for mixed allocations: they come from the
shared or reserved portion if there is one, otherwise from all the CPUs the
container runs on.

A besteffort container holding a claim is also not counted as a zero-request
shared container of its pool. Otherwise it would hold back a milli-CPU of
shared capacity there, and the last CPUs of its node could not be claimed.

A container's claims are fixed for its lifetime: the kubelet prepares them
before the container is created and unprepares them only after all of the
pod's containers have stopped, so no running container ever holds a released
claim. updateSharedAllocations leaves a claiming container with no shared
portion alone. One with a shared portion is updated like any other container,
and keeps its claimed CPUs. Containers with cpuPreserve keep the cpuset the
runtime gave them, as before.

How a container is linked to its claims

The policy reads the DRA_CPUSET_<claim UID> variable #821 puts in the
container's environment. A container holds a claim if it has the variable for
a claim grant the policy holds, and its value names that grant's CPUs. The
value is compared as a cpuset, so 0-1 and 1,0 name the same CPUs. A
variable for an unknown claim, or naming other CPUs, is ignored. No cache or
interface change is needed: the policy looks the variables up with the
existing GetEnv.

This is replaced later in the series: #852 tells claim requests apart by their CDI devices, and drops the variable.

The claims are looked up once, when the container is allocated, and kept on
its grant. Placement, pinning, CPU shares and the shared-pool checks all read
them from there, so pool scoring does not look up every claim for every
container.

This is a temporary approach. The pod spec can set the variable too, so a
pod which knows a claim's UID and CPUs can run on them without holding the
claim. A container's CDI devices name its claims and are set by the runtime
alone, so they are the right link. But not every maintained runtime release
reports them to NRI yet: containerd does from v2.3, CRI-O does not yet. We
switch to CDI device names once every maintained release of both runtimes
reports them.

What is not here

These are known limitations, each lifted by a later PR in the series:

  • Claims do not survive a restart. They are saved with the other grants,

  • but the policy resets its saved state on start, so after the plugin
    restarts their CPUs are free again and can be granted twice.
  • The NodeResourceTopology CR goes stale after a claim, as nothing

  • refreshes it when claimed CPUs leave the free supply.
  • No DeviceClass ships yet, so a claim needs one written by the user.

  • The e2e test creates its own.

    Verification

  • go test -race ./cmd/plugins/topology-aware/... ./pkg/resmgr/... passes,

  • and golangci-lint finds no issues.
  • The new policy test covers claiming containers that are besteffort, shared,

  • exclusive, exclusive and shared, reserved, and reserved with no CPU request,
    a container holding two claims, a variable naming other CPUs, one naming an
    unknown claim, and a claiming container keeping its claim while another
    claim comes and goes. For a claiming container it also checks the pool, the
    memory zone, the shared or reserved portion and the CPU shares. Each of
    these changes fails it: dropping the claimed CPUs from applyGrant, pinning
    a claiming container without its own CPUs, skipping every claiming container
    in updateSharedAllocations, placing a reserved container in the claim's
    pool, and zeroing the container's own CPU request in newRequest.
  • Another test places a besteffort container holding a claim and then claims

  • the rest of its node. It fails if the container is counted as a zero-request
    shared container. A third test checks that a container with a strict
    topology hint is allocated and keeps its claim, whether the claim matches
    the hint or not.
  • A claim variable naming the claim's CPUs in another form still links the

  • container. A container holding a claim stays on it across a reconfiguration.
    Comparing the value as a string, or not carrying the claims onto the grant
    or through a reconfiguration, fails the tests.
  • test42-dra-devices passes on n4c16 with Kubernetes 1.37, containerd

  • v2.4.1, and the DRAConsumableCapacity and DRANodeAllocatableResources
    gates. Every claiming container with no CPU request runs on exactly its
    claim's CPUs and on memory of its claim's node: 12-14 on node 3, 4-5 and 6-7
    on node 1, then 4-5 for the third claim once the first is released. A claim
    on the node the besteffort container runs on, node 0 in this run, gets 0-1.
    Two containers sharing one claim both run on its CPUs, 0-1, with node 0's
    memory. The besteffort container still runs on no claimed CPU and gets
    released CPUs back. A pod with a 100m CPU request of its own and a claim on
    node 2 runs on CPUs 8-11, all CPUs of node 2: the claimed CPUs plus the
    shared ones, with node 2's memory.

    Diff: 650 lines (+487 / -163) across 8 files Reviewer: bart0sh Review duration: 19938m
    All Vouch review confidence checks passed
    Residual risk 0.21 = Change Risk (0.52) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.52 · 650 lines diff across 8 files
    0.52
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.388
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #823"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 52% (MEDIUM) · Higher = larger blast radius
    52%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 20.5% · Safe to merge
    20.5%