Skip to content
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

Manual available memory calculation #626

Merged
merged 6 commits into from Mar 1, 2019

Conversation

mznet
Copy link
Contributor

@mznet mznet commented Jan 5, 2019

At kernel 3.14 MemAvailable metric was introduced, but under 3.14, MemAvailable didn't exist and needed to calculate manully to get, gopsutil have estimated it summing free, cached, and buffer metric. Summing metrics was good idea, could be approached to MemAvailable nearly, not perfectly. Calculating the metric more precisely, I am referring to psutil and kernel algorithm.

psutil
giampaolo/psutil@8504d93

kernel
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=34e431b0ae398fc54ea69ff85ec700722c9da773

…is needed to calcuate manually

manual available memory calculation should be done if only memavail is false

Manual Available Memory calculation under kernel 3.14

accurate manaul available memory calculation
@mznet mznet force-pushed the manual-available-memory-calculation branch from b9a6bc5 to 73545ec Compare January 6, 2019 14:22
Copy link
Owner

@shirou shirou left a comment

Choose a reason for hiding this comment

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

Thank you for your contribution, it is good point! I commented some small things. I will merge if you update.

mem/mem_linux.go Outdated Show resolved Hide resolved
mem/mem_linux.go Outdated Show resolved Hide resolved
mem/mem.go Outdated Show resolved Hide resolved
@shirou
Copy link
Owner

shirou commented Feb 22, 2019

@Lomanic Thank you for reviewing. I think this is good to merge now. How do you think?

@shirou shirou merged commit 6c6abd6 into shirou:master Mar 1, 2019
@shirou
Copy link
Owner

shirou commented Mar 1, 2019

Merged it. Thank you for your contribution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants