sys_mem: check /proc/meminfo to get available memory #598
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.
sysinfo(2) is unaware of cache, but we can still fall back to it in case /proc/meminfo isn't available.
After testing some more on my integrated gfx1035 I realized #595 is too pessimistic. sysinfo(2) is unable to get the same information that free(1) gets, and we're really interested in the "available" number.
So for example, with 32 GiB system memory (16 GiB allocated to GPU)
free
says I have 12 GiB free and 11 GiB cached (23 GiB available). With the code that only looks atsysinfo
none of the test cases will run - when we take away the 16 GiB for the GPU from 12 GIB free, there's nothing left.free(1) ultimately looks at /proc/meminfo to know its numbers so just look there first.