3 ms·
I never quite understood why there is no way to ask the kernel for "weak memory" that can be deallocated at the kernel's whim.
by drdo 5y ago
I never quite understood why there is no way to ask the kernel for "weak memory" that can be deallocated at the kernel's whim.
- zozbot234 5y agoIsn't MADV_FREE supposed to do that?
- skywal_l 5y agoBut this is for mapped (or shared) memory. Not reserved memory I think. No suitable to the OP's purpose: have reserved "optional" memory you could use for caching.
- skywal_l 5y agoI Should have RTFM: "The MADV_FREE operation can be applied only to private anonymous pages (see mmap(2)). In Linux before version 4.12, when freeing pages on a swapless system, the pages in the given range are freed instantly, regardless of memory pressure."