Repository navigation
pool: count a swap-cached page once in the memory_limit anon - #541
Merged
Merged
Conversation
A page faulted back from swap keeps its swap slot, so it is both in AnonPages and in SwapTotal - SwapFree. On a guest with 4.0 GiB of anon, the old sum read 7.03 GiB, the excess equal to SwapCached, so a node that swapped and faulted back refused claims early.
Contributor
Author
Hardware verification: passSetup. Neither testbed host has swap, so the test ran in a guest with its own 8G swapfile. 4096 MiB of anon was written under
|
Contributor
Author
Ground truth, 100 ms samplingSetup.
Error against truth, in MiB:
* lru =
|
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.
A page that faults back in from swap keeps its swap slot. That page is then counted twice: once in
AnonPagesand once in used swap (SwapTotal - SwapFree). BecausereadAnonBytesadded the two, it over-counted bySwapCached.Change
readAnonBytesnow returnsAnonPages + SwapTotal - SwapFree - SwapCached.docs/deploy.md: thememory_limitrow describes the new formula.TestMemoryLimitCrossingshas a new case, "swap-cached anon counts once": 250G anon, 51G swap, 40G swap-cached, limit 300G. The node must stay under the limit and the gauge must read 261G. The old formula fails this case.SwapCachedas a parameter instead of a fixed 99 kB.Evidence (hardware, inside a guest with its own swapfile; neither testbed host has swap)
After 4.0 GiB of anon was pushed to swap and faulted back:
readAnonBytes, old formulaAnonPagesThe effect is that a node refuses claims too early, never too late. A production host that has swapped and faulted pages back reads high by up to its used swap.
Gates
make go-lint: 10×0 issues.asl -forwarder=false ./...: clean on both GOOS.go test -race ./pool/: ok.- SwapCachedfails the new case.