Comment 15 for bug 1827258

Revision history for this message
Bin Yang (byangintel) wrote :

As I mentioned above, " free < min, kernel will start oom killer".

And you can find the kernel code for this logic:
mm/page_alloc.c:
__zone_watermark_ok()
=============================

        /*
         * Check watermarks for an order-0 allocation request. If these
         * are not met, then a high-order request also cannot go ahead
         * even if a suitable page happened to be free.
         */
        if (free_pages <= min + z->lowmem_reserve[classzone_idx])
                return false;

        /* If this is an order-0 request then the watermark is fine */
        if (!order)
                return true;

And here is a related document:
https://www.kernel.org/doc/Documentation/sysctl/vm.txt
min_free_kbytes:
================

This is used to force the Linux VM to keep a minimum number
of kilobytes free. The VM uses this number to compute a
watermark[WMARK_MIN] value for each lowmem zone in the system.
Each lowmem zone gets a number of reserved free pages based
proportionally on its size.

Some minimal amount of memory is needed to satisfy PF_MEMALLOC
allocations; if you set this to lower than 1024KB, your system will
become subtly broken, and prone to deadlock under high loads.

Setting this too high will OOM your machine instantly.

And the watermarks are setup base on this kernel parameter:
========================
mm/page_alloc.c
init_per_zone_wmark_min()

The default setting is calculated based on your total system memory size. I think min watermark = 53464kB is reasonable.