← Back to Pull requests

DRA: allocate topology-aware claims #821

Closed
unknown closed this pull request without merging on Oct 12, 2026 14:53 UTC
View on GitHub
unknown unknown commented on Sep 30, 2026 13:31 UTC
Author

Allocating and releasing CPUs for claims

The topology-aware policy implements AllocateClaim and ReleaseClaim now, so a claim against the NUMA devices #820 publishes gets CPUs of those nodes, and the test42-dra-devices e2e test is extended to claims.

What a claim gets

Each allocation result names a NUMA node device, and consumes some dra.cpu/cpu of it. AllocateClaim decodes that into a number of CPUs per node.

For each node it picks that many CPUs out of the node's free, grantable CPUs, isolated plus sharable less reserved, with the same cpuAllocator an exclusive grant uses. Two CPUs are therefore the two threads of one core, not one thread of each of two cores. Several results on one node get disjoint CPUs, and if one result cannot be filled, nothing stays claimed.

The container gets one CDI edit per result, each setting DRA_CPUSET_<claim UID>=<cpuset> to the whole claim's CPUs.

ReleaseClaim gives the CPUs back, and releasing an unknown claim is not an error, as the kubelet may unprepare a claim more than once.

A claim is a grant

A claim's CPUs are held as a grant, the policy's existing record of what is allocated: exclusive CPUs reserved from the deepest pool holding all of them, with no shared portion and no memory. Claim grants are kept beside the container grants in allocations, keyed by claim UID, and a claim grant has no container. So the NRI path cannot hand claimed CPUs to an exclusive or shared grant while the claim lives, and the claim is checked, dumped and saved with the other grants. Claim UIDs and container IDs stay separate keyspaces: in the saved state a claim grant is keyed claim:<uid>.

Reserving the grant refuses CPUs another grant holds, and refuses sharable CPUs whose loss would overcommit the shared portions already granted, as for any exclusive grant.

After a claim or release, updateSharedAllocations recomputes the shared cpusets, so shared containers move off claimed CPUs and back onto released ones.

Reconfigure rebuilds the pool tree and reinstates the claim grants before the container grants. A claim's CPUs cannot move, so a configuration which would take a claimed CPU away from us, by reserving it for example, is refused and the old configuration stays.

What is not here

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

  • The claiming container is not pinned to its claim's CPUs.

  • 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

  • The new policy tests run on the recorded server sysfs. They cover one and several results on one or two nodes, a whole node, a node less its reserved CPUs, and each refused result, including a claim with no results. They also check picking by topology, re-preparing a claim, disjoint claims and exhaustion, a failed multi-result claim leaving nothing claimed, release, a Reconfigure which keeps claims and one refused for reserving a claimed CPU, and a claim and a container with the same ID both surviving a reconfiguration and a round trip through the cache.

  • Each of these mutations fails the tests: skipping the claim reinstatement in Reconfigure, skipping the release, and picking anew on a repeated prepare.

  • A test covers the shared overcommit check: on a node whose shared containers leave a little over one CPU's worth of shared capacity, reserving a claim grant of two sharable CPUs is refused and leaves nothing reserved, and one of one CPU succeeds. AllocateClaim already picks only what the shared containers can spare, so the test reserves directly.

  • The move of shared containers is not covered by the unit tests, since it needs pinned containers the test cache cannot supply. The e2e test below covers it.

  • test42-dra-devices passes on n4c16 with Kubernetes 1.37 and the DRAConsumableCapacity and DRANodeAllocatableResources gates. With CPU 15 reserved, the devices offer exactly 4, 4, 4 and 3 CPUs. A claim for all of node 3 gets 12-14. Two 2-CPU claims on node 1 get one core each, 4-5 and 6-7. A third stays unscheduled until the first is deleted, then gets 4-5. A besteffort container runs on no claimed CPU, gives up the two CPUs a claim takes of its node, and gets them back on release.
  • Diff: 575 lines (+431 / -144) across 7 files Reviewer: bart0sh Review duration: 17361m
    All Vouch review confidence checks passed
    Residual risk 0.20 = Change Risk (0.50) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.50 · 575 lines diff across 7 files
    0.50
    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.380
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #821"
    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: 49.8% (MEDIUM) · Higher = larger blast radius
    49.8%
    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: 19.7% · Safe to merge
    19.7%