memory-policy: fix policies with no nodes #832
All Vouch review confidence checks passed
Residual risk 0.14 = Change Risk (0.36) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.36 · 198 lines diff across 2 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.317
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #832"
general
weight: 0.35
askervin
Fix memory policies with no nodes
This fixes two bugs in the memory-policy plugin. Both are in how it resolves the nodes of a policy.
A policy without nodes crashes the plugin
nodesis optional in a policy, but the plugin readsNodes[0], which panics when it is empty. For example, this annotation crashes the plugin on the first container it applies to:The container starts anyway, with the default memory policy, and nothing reports it. When the plugin is restarted, it crashes again on the next such container.
No nodes now means
allowed-mems.MPOL_DEFAULT and MPOL_LOCAL cannot be used
The kernel refuses any nodes for these two modes (see
set_mempolicy(2)). But everynodesvalue resolves to some nodes, and nonodescrashes the plugin. So a container with one of these modes either fails to start, becausempolsetexits withinvalid argument, or loses its policy.These modes now get no nodes, and a
nodesvalue with them is refused with an error.Testing
TestToLinuxMemoryPolicyNodes, the first unit test of the plugin, covers both fixes. Without them it panics.injectMpolset: true, checked in the container's/proc/1/numa_maps:MPOL_INTERLEAVEwith no nodes givesinterleave:0-3,MPOL_LOCALgiveslocalandMPOL_DEFAULTgivesdefault.MPOL_LOCALwithnodes: 0-1is refused withmemory policy mode MPOL_LOCAL takes no nodes, got "0-1". Before the fix, the first case crashed the plugin.