Skip to content

Use MemAvailable instead of MemFree to estimate actual available memory #39481

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 13, 2019

Conversation

KentaTada
Copy link
Contributor

Signed-off-by: Kenta Tada Kenta.Tada@sony.com

- What I did
I used MemAvailable instead of MemFree when Linux kernel supports it. Linux kernel version >=3.14 shows how much memory is actually available via MemAvailable.
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=34e431b0ae398fc54ea69ff85ec700722c9da773

- How I did it
I modified parseMemInfo method to handle MemAvailable from "/proc/meminfo"

- How to verify it
I modified "meminfo_unix_test.go" to test whether this change can handle MemAvailable

- Description for the changelog

Use MemAvailable instead of MemFree to estimate actual available memory

- A picture of a cute animal (not mandatory but encouraged)

Signed-off-by: Kenta Tada <Kenta.Tada@sony.com>
@crosbymichael
Copy link
Contributor

LGTM

@codecov
Copy link

codecov bot commented Jul 10, 2019

Codecov Report

❗ No coverage uploaded for pull request base (master@f550cb5). Click here to learn what that means.
The diff coverage is 100%.

@@            Coverage Diff            @@
##             master   #39481   +/-   ##
=========================================
  Coverage          ?   37.31%           
=========================================
  Files             ?      609           
  Lines             ?    45229           
  Branches          ?        0           
=========================================
  Hits              ?    16876           
  Misses            ?    26063           
  Partials          ?     2290

Copy link
Member

@thaJeztah thaJeztah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@thaJeztah thaJeztah merged commit 44a3267 into moby:master Jul 13, 2019
@thaJeztah
Copy link
Member

Thanks!

@thaJeztah thaJeztah added this to the 20.03.0 milestone Apr 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants