Skip to content

[release-1.0] Cherry-pick #3476: leave page cache out of the memory guard's overshoot check - #3513

Merged
Dmitry Berkovich (dberkov) merged 1 commit into
agent-substrate:release-1.0from
BenTheElder:cherry-pick-3476-release-1.0
Oct 31, 2026
Merged

Dmitry Berkovich (dberkov) merged 1 commit into
agent-substrate:release-1.0from
BenTheElder:cherry-pick-3476-release-1.0

Conversation

@BenTheElder

Copy link
Copy Markdown
Collaborator

Cherry-pick of #3476 onto release-1.0 (git cherry-pick -x of the squash commit), it applied cleanly with no changes.

The memory guard's overshoot check leaves reclaimable page cache out, so it no longer kills a paused microVM and reports the actor crashed when a snapshot write leaves dirty page cache behind. This fixes a bug in #3429, which is in 1.0.

AI use: AI-assisted. Clean pick.

  • Tests pass
  • Docs updated

…strate#3476)

Follow-up to agent-substrate#3429, from @aramase's review:
agent-substrate#3429 (comment)

When the pod can lend a microVM snapshot write all the memory it needs,
the actor's cgroup has no `memory.high` during the write, so it can end
with a lot of dirty page cache. Putting `memory.high` back reclaims what
it can, but gives up on pages still dirty or under writeback:
https://github.com/torvalds/linux/blob/v7.0/mm/memcontrol.c#L4409-L4429

The memory guard resumes as soon as the write returns, before teardown,
and its overshoot check counted that page cache. So it could kill the
paused VM and report the actor crashed for exceeding its memory limit.

The overshoot check now leaves reclaimable page cache out too, and both
checks take what's left from one `memory.stat` read. The kernel only
flushes `memory.stat` past a threshold of updates, so it can trail
`memory.current`, and subtracting one from the other could count fresh
page cache as used:
https://github.com/torvalds/linux/blob/v7.0/mm/memcontrol.c#L561-L564

AI use: AI-assisted, I reviewed and tested it.

- [x] Tests pass
- [x] Docs updated

---------

Signed-off-by: Benjamin Elder <[email protected]>
(cherry picked from commit 6ddb193)
Signed-off-by: Benjamin Elder <[email protected]>
@dberkov
Dmitry Berkovich (dberkov) merged commit 9754aea into agent-substrate:release-1.0 Oct 31, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/gvisor area/microVM area/node kind/bug Something isn't working / bugfixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants