Skip to content

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

Merged
thaJeztah merged 1 commit into
moby:masterfrom
KentaTada:use-memavailable
Jul 13, 2019
Merged

Use MemAvailable instead of MemFree to estimate actual available memory#39481
thaJeztah merged 1 commit into
moby:masterfrom
KentaTada:use-memavailable

Conversation

@KentaTada

Copy link
Copy Markdown
Contributor

Signed-off-by: Kenta Tada [email protected]

- 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)

@crosbymichael

Copy link
Copy Markdown
Contributor

LGTM

@codecov

codecov Bot commented Jul 10, 2019

Copy link
Copy Markdown

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

@thaJeztah thaJeztah left a comment

Copy link
Copy Markdown
Member

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
Copy Markdown
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