fix(lcow/v2): report physically backed VM stats#2834
Merged
rawahars merged 2 commits intoJul 23, 2026
Merged
Conversation
rawahars
reviewed
Jul 21, 2026
shreyanshjain7174
force-pushed
the
user/shsancheti/fix-lcowv2-physically-backed-stats
branch
from
July 21, 2026 11:00
b1474f8 to
1fc6a13
Compare
Contributor
|
This PR can be superseded by 47c5b14 which correctly sets the param in SandboxOptions which in turn calculates the stats properly. |
Contributor
Author
|
Thanks, Harsh. Does |
Contributor
|
@shreyanshjain7174 Yes let's keep your changes in |
Signed-off-by: Shreyansh Sancheti <shsancheti@microsoft.com>
shreyanshjain7174
force-pushed
the
user/shsancheti/fix-lcowv2-physically-backed-stats
branch
from
July 23, 2026 10:00
1fc6a13 to
e3303f0
Compare
In the v2 LCOW builder, SandboxOptions.FullyPhysicallyBacked was taken straight from the FullyPhysicallyBacked annotation. It feeds isPhysicallyBacked, which only drives VM memory/working-set stats, so setting AllowOvercommit=false alone left it false and a physically backed VM had its stats computed as if VA-backed. Set it to !AllowOvercommit so it reflects the VM's actual memory backing; the annotation still forces overcommit off. v2 has no VSMB/VPMem, so there is no separate devices-physically-backed notion. Also update the parity check to compare against !AllowOvercommit and add a regression test for overcommit-off alone. Signed-off-by: Harsh Rawat <harshrawat@microsoft.com>
rawahars
approved these changes
Jul 23, 2026
shreyanshjain7174
deleted the
user/shsancheti/fix-lcowv2-physically-backed-stats
branch
July 23, 2026 11:22
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
SandboxOptions.FullyPhysicallyBackedfrom the final VM memory configuration (!Memory.AllowOvercommit)AssignedMemoryThis includes Harsh's
47c5b143patch, cherry-picked ase3e4cfb6, together with the complementaryvm.golookup gating.Problem
LCOW V2 physically backed sandbox stats had two related failure modes:
AllowOvercommit=falsewithout the strongerFullyPhysicallyBackedannotation leftSandboxOptions.FullyPhysicallyBackedfalse, so the controller selected the VA-backed stats path for physically backed VM memory;Stats()looked up vmmem before checking the backing mode, even though physically backed UVMs use HCSAssignedMemory. A failed lookup therefore prevented metrics that do not require vmmem.Implementation
FullyPhysicallyBackedannotation separately for device-backing behavior and its existing overcommit overrideSandboxOptions.FullyPhysicallyBackedfrom the finalized memory configurationLookupVMMEMand process working-set collection inside the VA-backed branchAllowOvercommit=falsewithout the annotationValidation
go test -tags lcow ./internal/builder/vm/lcow/... ./internal/controller/vm/... -count=1go vet -tags lcow ./internal/builder/vm/lcow/... ./internal/controller/vm/...containerd-shim-lcow-v2.exewith both changes and ranTest_SandboxStats_WorkingSet_PhysicallyBacked/LCOWagainst a local build 26200 host: PASS