Current-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: X server being killed a lot (Thomas Klausner) writes:

>On Mon, Oct 22, 2018 at 12:18:01PM -0400, Michael wrote:
>> It helped somewhat to add this to sysctl.conf:
>> vm.filemin=2
>> vm.filemax=10
>> now it still uses well over 10% or memory as file cache but seems more
>> willing to shrink it.

filemax is not the limit for the cache but the level it tries to keep
when pressed for memory.

>Is there some delay until these values are really used? Or are they only
>relevant if we're below the magic boundary and afterwards they are not
>enforced so much because the limit has already been broken? How do those
>limits work?

The three types anon, file and exec can grow as long as memory permits.

Things change when free memory drops below some limit, then the page
daemon tries to free inactive pages. inactive pages are those that
haven't been used recently.

When scanning for pages to free, it follows a simple heuristic. Pages
that belong to a type (anon,file,exec) that is below the minimum will
be skipped, pages that belong to a type that is above minimum but
below maximum will be skipped if any other type is above maximum.

If all types would be skipped (then all are below minimum), then nothing
is skipped.

If only file and exec would be skipped but swap is full (so anon cannot
be paged out), then nothing is skipped.

As a side effect, pages skipped in the scan are activated and thus
removed from the inactive queue for some time.

So the heuristic first tries to reduce everything to the maximum,
then tries to reduce everything to the minimum, and then as far as
possible. It will never try to free active pages.

                                Michael van Elst
                                "A potential Snark may lurk in every tree."

Home | Main Index | Thread Index | Old Index