calculateMemUsageUnixNoCache: subtract total_inactive_file, not cache#2415
Merged
thaJeztah merged 1 commit intodocker:masterfrom Apr 10, 2020
Merged
calculateMemUsageUnixNoCache: subtract total_inactive_file, not cache#2415thaJeztah merged 1 commit intodocker:masterfrom
thaJeztah merged 1 commit intodocker:masterfrom
Conversation
15c3d1c to
f6ef10b
Compare
4e0b583 to
e4ac9b1
Compare
Collaborator
Author
|
CI failure is unrelated: #2412 |
Member
|
Previous change related to was #80 |
thaJeztah
approved these changes
Apr 6, 2020
Member
thaJeztah
left a comment
There was a problem hiding this comment.
SGTM
but pinging @cpuguy83 @crosbymichael @tiborvass for review as well
| func calculateMemUsageUnixNoCache(mem types.MemoryStats) float64 { | ||
| return float64(mem.Usage - mem.Stats["cache"]) | ||
| // cgroup v1 | ||
| if v, isCgroup1 := mem.Stats["total_inactive_file"]; isCgroup1 && v < mem.Usage { |
Member
There was a problem hiding this comment.
Do we use this information elsewhere (in the daemon) as well? Just making sure that there's no logic somewhere using the old calculation.
Also /cc @SamWhited (I think UCP does some similar calculations for the UI)
Collaborator
Author
There was a problem hiding this comment.
Not in the daemon AFAIK
cpuguy83
approved these changes
Apr 6, 2020
Member
|
@AkihiroSuda can you rebase to make CI go green? I'll merge after that |
The new stat definition corresponds to containerd/CRI and cadvisor. https://github.com/containerd/cri/blob/c1115d4e57f55a5f45fb3efd29d3181ce26d5c6a/pkg/server/container_stats_list_unix.go#L106-L129 google/cadvisor@307d1b1 Fix moby/moby#40727 Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
e4ac9b1 to
a4a07c6
Compare
Collaborator
Author
|
rebased |
Member
|
thanks! all green - merging |
LarsMichelsen
pushed a commit
to Checkmk/checkmk
that referenced
this pull request
Mar 17, 2021
Docker 20.10 changed the way how memory usage of docker containers is calculated, the docker check was adapted accordingly. See docker/cli#2415 for more information. CMK-5224 Change-Id: Ib6c6aa21f61f5cd750209dc3b3bda82041f9d49c
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.
- What I did
Changed
mem.Usage - mem.Stats["cache"]incalculateMemUsageUnixNoCache()used bydocker statsCLI tomem.Usage - mem.Stats["total_inactive_file"].Fix moby/moby#40727
- How I did it
The new stat definition corresponds to containerd/CRI and cadvisor.
https://github.com/containerd/cri/blob/c1115d4e57f55a5f45fb3efd29d3181ce26d5c6a/pkg/server/container_stats_list_unix.go#L106-L129
google/cadvisor@307d1b1
- How to verify it
See moby/moby#40727
- Description for the changelog
Changed
mem.Usage - mem.Stats["cache"]incalculateMemUsageUnixNoCache()used bydocker statsCLI tomem.Usage - mem.Stats["total_inactive_file"].- A picture of a cute animal (not mandatory but encouraged)
🐧