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

missing opposite to mem_avail_percents #2065

Open
nekopsykose opened this issue Jun 25, 2024 · 0 comments
Open

missing opposite to mem_avail_percents #2065

nekopsykose opened this issue Jun 25, 2024 · 0 comments

Comments

@nekopsykose
Copy link

nekopsykose commented Jun 25, 2024

the memory block has the following values:

//! `mem_free` | Free memory not yet used by the kernel or userspace (in general you should use mem_avail)
//! `mem_free_percents` | as above but as a percentage of total memory
//! `mem_avail` | Kernel estimate of usable free memory which includes cached memory and buffers
//! `mem_avail_percents` | as above but as a percentage of total memory
//! `mem_total_used` |  mem_total - mem_free
//! `mem_total_used_percents` | as above but as a percentage of total memory
//! `mem_used` | Memory used, excluding cached memory and buffers; same as htop's green bar
//! `mem_used_percents` | as above but as a percentage of total memory

mem_used is the used memory, but it excludes buffers. this green bar in htop does not include 'buffers/shared memory', which means it's not what free actually reports for used, which is the opposite of mem_avail.

for example the following:

free:

$ free
               total        used        free      shared  buff/cache   available
Mem:        32799040    22935160     1896944    12413232    20856892     9863880
Swap:       18874360     9843712     9030648

but in mem_used_percents, this is seen as 30%, even though it should be more like 65%+. this is because it presumably excludes shared memory from the calculation?

it would be nice if either it took that into account, or there was a new value that was just 1 - mem_avail_percents

if you want to test this yourself, you can easily force a large shared memory allocation by placing a huge file into tmpfs, e.g. fallocate -l 10G /tmp/bigfile. these usages are what is missing in mem_used even though they are actually used

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

No branches or pull requests

1 participant