Hacker News new | ask | show | jobs
by serxa 474 days ago
Vmscan is not single-threaded. Every thread that tries to allocate more memory when current memory consumption equals memory limit triggers vmscan. So lru_lock is used only to isolate some pages to scan and later to return pages that were not reclaimed back to cgroup. The scan itself is done without lru_lock.

The first problem was that the vmscans are done under mmap_read_lock. And there is no good reason for it. It happened that vmscan is called from page fault that requires mmap_lock. At least some parts of page fault handling require mmap_lock, but definitely not reclaiming itself.

> Always bring memory usage down to at most ~95% (configurable) of the cgroup limit I agree. It could be sometimes done in the application itself.