DRA: allocate topology-aware claims #821
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
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
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
bart0sh
Allocating and releasing CPUs for claims
The topology-aware policy implements
AllocateClaimandReleaseClaimnow, so a claim against the NUMA devices #820 publishes gets CPUs of those nodes, and thetest42-dra-devicese2e test is extended to claims.What a claim gets
Each allocation result names a NUMA node device, and consumes some
dra.cpu/cpuof it.AllocateClaimdecodes 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
cpuAllocatoran 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.ReleaseClaimgives 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 keyedclaim:<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,
updateSharedAllocationsrecomputes the shared cpusets, so shared containers move off claimed CPUs and back onto released ones.Reconfigurerebuilds 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:
DeviceClassships yet, so a claim needs one written by the user. The e2e test creates its own.Verification
serversysfs. 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, aReconfigurewhich 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.Reconfigure, skipping the release, and picking anew on a repeated prepare.AllocateClaimalready picks only what the shared containers can spare, so the test reserves directly.test42-dra-devicespasses on n4c16 with Kubernetes 1.37 and theDRAConsumableCapacityandDRANodeAllocatableResourcesgates. 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.