Swap changes in master, enforcement of RLIMIT_RSS

Matthew Dillon dillon at backplane.com
Wed Dec 28 14:32:55 PST 2016


The maximum supported swap space has been significantly increased in
master.  The amount of core memory required to manage swap is approximately
1:128 (ram:swap-used).  The system allows up to half of your core ram to be
used for swap management so the maximum swap you can actually use on a
machine would be as follows:

With 1GB of ram it would be 512M*128 = 64GB of swap.

With 8GB of ram it would be 4G*128 = 512GB of swap.

With 128GB of ram it would be around ~8TB of swap.

The maximum the system supports due to KVM limitations is around ~32TB of
swap.

While you can configure more swap than the above limitations, the system
might not be able to actually manage as much as you configure.  I'm
considering improving the management code to reduce its memory
requirements.  Also, people shouldn't go overboard w/regards to configuring
swap space.  Configured swap does eat some memory resources even when not
actively in-use, and there might not be a practical use for having such
massive amounts of swap with your setup.

--

The memoryuse resource limit (ulimit -m in /bin/sh) is now being enforced
on a per-process basis.  By default this limit is infinity so nothing will
change for most people.  Setting a memoryuse limit has advantages in
certain circumstances as long as it isn't over-used.  For example, it might
be reasonable to start your browser with a 500m (500 megabyte) limit.  The
system will allow each process VSZ to grow larger, but will force the RSS
to the limit and devalue the pages it removes to make them more likely to
be recycled by the system.

There is a sysctl, vm.pageout_memuse_mode, to control the behavior.  It can
be set to 0, 1, or 2, and defaults to 1.  Setting it to 0 disables the
enforcement (system operates the same as it did before the commit).  The
default value of 1 enables enforcement by removing pages from the process
pmap and deactivating them passively.  The value 2 enables enforcement and
actively pages data out and frees pages.   Mode 2 can cause excessive
paging and wear out your SSD so it is not currently recommended.

-Matt
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.dragonflybsd.org/pipermail/users/attachments/20161228/4ff8510c/attachment.html>


More information about the Users mailing list