Hacker News new | ask | show | jobs
by man8alexd 28 days ago
Linux MemAvailable from /proc/meminfo is just an estimation calculated as an arbitrary percentage (50%) of free and potentially reclaimable memory.

You can't determine how much of the memory can actually be reclaimed under memory pressure until you try to reclaim it.

1 comments

> You can't determine how much of the memory can actually be reclaimed under memory pressure until you try to reclaim it.

Yes, and I’m arguing that we should be able to, by having the kernel keep track.

The kernel keeps track of active/inactive pages by scanning page tables during the reclaim process. It only scans until it finds enough inactive pages to reclaim. Scanning all pages all the time is very expensive from a performance point of view.