Include buffer/cache memory as free memory on linux#9
Include buffer/cache memory as free memory on linux#9dustin-decker wants to merge 1 commit intopbnjay:masterfrom
Conversation
|
I know that BSD + ZFS has similar filesystem caching going on, we could make a similar change there. I had debated this in the initial implementation, but hesitated because the primary use is to allow "dynamic code to minimize thrashing and other contention." I don't have any benchmarks to back up the possible contention from filling available memory with application data in a read-heavy app, which is why I hesitate to include it directly. Do you have any ideas on how to validate that? At the very least I think it should be mentioned in the documentation. I think a simple solution to both challenges could be to feature gate the inclusion with some sort of explicit opt-in and explanation. e.g. you'd have to call |
|
In my application, we throttle down some concurrency when there is memory pressure, which we've defined as <2GB free. On a machine with 16GB of memory we had ~11GB of buffer/cache (primarily page cache) but only ~500mb actually free. This certainly would be a breaking change for the library. What about introducing a |
|
Actually, I think it may be best to add a |
|
Closing this in favor of #10 |
The Linux kernel will typically use almost all free memory for buffering/cache purposes such as the page cache, freeing immediately as needed for applications. This buffer should be considered free memory.