1

I have a system with very spikey memory usage and lots of disk activity. As such, I'd like to have files in the cache as much as possible but I'd like to have enough free RAM ready to go to quickly respond to user mode processes that require more RAM for a short time. I'm basically trying to reduce latency for sudden user mode memory allocations by "always" having the typical amount of RAM needed ready to go. I'm expecting memory spikes in range 300–500 MB so I'd like to have that amount of RAM free most of the time.

I know that increasing /proc/sys/vm/vfs_cache_pressure keeps more of the disk cache in RAM in case of memory pressure so I've set it to 120 (this improves caching of dentries which I've found good for my workload). I also know about /proc/sys/vm/min_free_kbytes which reserves RAM so I've set it to 300000 to make sure there's always 300 MB free ready for use.

However, it seems that user mode processes are not allowed to use the RAM reserved by min_free_kbytes. Is there some kernel setting that would allow me to tell the kernel that it should try to keep e.g. 300 MB free RAM ready at all times? That is, if an user mode program wants RAM, give it immediately from that reserve and start a background process to make more free RAM (e.g. write dirty pages, drop some disk caches) to match that reserve again for future user mode processes.

If I've understood things correctly, I'm looking for a setting to reserve memory in addition to min_free_kbytes that cannot be used for disk cache but is free to be allocated by any user processes.

0 Answers0