Tip for Desktop Memory management, new vm tuning option

Bret Busby bret.busby at gmail.com
Tue Jul 30 14:24:49 UTC 2019


On 30/07/2019, Rashkae <ubuntu at tigershaunt.com> wrote:
> Recent Linux Kernels since Ubuntu 16.04 have had changes to Virtual
> Memory management that drastically hurt performance on Desktop loads
> where RAM is not always sufficient for all running apps.  With 4 to 8 GB
> desktops it's easy, if multi-tasking, to starve the RAM.  With older V3
> and 4.4 Linux kernels, swap on an SSD, you could easily drive the system
> memory usage several GB past your RAM and not even notice.
>
> However, with Newer linux kernels, if memory usage approaches your RAM,
> applications that try to allocate a large chunk of memory could quickly
> send a system into a swap tailspin that renders the system inoperable
> until rebooted or processes manually killed.  I've tripped over this
> several times over the past few years, and I finally found the change
> that causes it, Documented Here:
>
> https://www.fclose.com/linux-kernels/642756/mm-scale-kswapd-watermarks-in-proportion-to-memory-linux-4-6/
>
> The key to avoiding this swap lock problem is to increase
> /proc/sys/vm/watermark_scale_factor
>
> It defaults to 10.  In my testing, 100 is still not enough to avoid the
> problems, but increasing it to 500 *drastically* improves the computer's
> ability to handle memory over-commit without falling on it's face.
>
> On my 8GB system, I can have several browser windows, thunderbird, Open
> Office, calibre and a few movies playing, (brining my RAM usage past
> 6GB), then open a 4GB Windows 10 VirtualBox instance, and everything
> works with no noticeable slowdowns or hitches.  This was completely
> impossible before.
>
> If you want to try this, the change can be made permanent by adding this
> line in /etc/sysctl.conf.  Run sudo sysctl --system to apply changes
> without reboot.
>
>
> vm.watermark_scale_factor=500
>
>


I have looked in the file, to find whether a similar (with a lesser
setting) line exists, and did not find one.

If the line is inserted in the file, where should it be inserted, or,
does it not matter?


-- 
Bret Busby
Armadale
West Australia
..............

"So once you do know what the question actually is,
 you'll know what the answer means."
- Deep Thought,
 Chapter 28 of Book 1 of
 "The Hitchhiker's Guide to the Galaxy:
 A Trilogy In Four Parts",
 written by Douglas Adams,
 published by Pan Books, 1992

....................................................




More information about the ubuntu-users mailing list