On most systems, the low-memory notification signal to Chrome is a simple function of the values of "easily reclaimable" RAM (ER-RAM) and free swap space. On some systems---specifically caroline---we changed this to ignore swap space (i.e. we use a simple threshold for the value of ER-RAM) and for good reasons we're leaning to moving all systems to this direction.
These approaches are simple and appear to work reasonably well, and, because the behavior of the kernel memory manager is somewhat chaotic (i.e. it appears to drastically change behavior in unpredictable spurts), it may well be the best we can do, or close enough. But there are obvious issues.
1. Our preference for strongly minimizing kernel OOM kills forces us to choose a threshold that may be too conservative in most situations, except for the worst cases.
2. We have seen that the relative frequency of OOM kills varies considerably across platforms, so one-size-fits-all doesn't work too well.
For instance, with respect to issue #1, the current choice of a threshold for the ER-RAM does not consider that when swap space is available, during excess allocation pages are also swapped out at a similar rate, thus the free pool doesn't get exhausted as rapidly as when swap space is full and reclaim by swapping is no longer possible (*). A mechanism that takes this into account may be more memory-efficient. One such mechanism would still use a simple threshold for ER-RAM, but increase it as the swap space becomes full.
To evaluate such mechanisms we need better data, as described in issue 773110.
Comment 1 by semenzato@chromium.org
, Oct 9 2017