Properly support madvise(MADV_FREE) on linux
Categories
(Core :: Memory Allocator, enhancement, P3)
Tracking
()
People
(Reporter: glandium, Unassigned)
Details
Reporter | ||
Updated•6 years ago
|
Comment 1•3 years ago
|
||
Hi Glandium.
What's the difference between MADV_FREE and MADV_DONTNEED. The descriptions are so similar.
Comment 2•3 years ago
|
||
I'm not glandium, but my understanding is that MADV_DONTNEED
will free the pages immediately and synchronously; in contrast, MADV_FREE
permits the kernel to free them at a later point, meaning that if there isn't memory pressure before we use the pages again then we don't have the overhead of removing and reestablishing the page table entries.
Updated•2 years ago
|
Comment 3•2 years ago
|
||
Note that MADV_FREE may make Firefox much more attractive to the OOM-killer on linux (though it's likely fairly attractive already): https://stackoverflow.com/questions/74358183/why-golang-madv-free-leads-to-oom-sometimes
MADV_FREE will make us appear to use more RSS; jlebar landed code a Long Time Ago to purge MADV_FREE pages on Mac before we measure RSS: bug 693404. This helps us in our internal RSS measurements (for about:memory), but not for any external measurements
Comment 4•2 years ago
|
||
Note that MADV_FREE until kernel 4.12 on an swapless, system will immediately free memory on MADV_FREE, and other issues make MADV_FREE on linux <4.12 problematic:
https://kernelnewbies.org/Linux_4.12#Memory_management
MADV_FREE has several issues that make it unusable in software like jemalloc: doesn't support system without swap enabled, increases memory pressure, and accounting problems. This release puts MADV_FREE pages into the LRU_INACTIVE_FILE list, enables MADV_FREE for swapless systems and improves statistic accounting
4.12 looks like it was released in 2017
Reporter | ||
Updated•1 year ago
|
Description
•