vm.min_free_kbytes seems very big

Adrian Schmutzler mail at adrianschmutzler.de
Sat Feb 27 10:40:16 EST 2021

Hi Felix,

due to some OOM issues I recently became aware that OpenWrt (or rather, you in [1]) set the vm.min_free_kbytes to quite excessive values:

16M for 128M RAM
8M for 64M RAM

The value for 32M devices has been reduced in a later patch [2].

These values seem high (1/8 or 12.5 %), and in a kernel comment here [3] we found a much lower recommendation, even addressing low-mem devices.

Apart from theoretical discussions, this is of cause a real problem on 64MB RAM devices (particularly with ath10k active), where RAM is scarce.
On a typical OpenWrt installation, OOM-Killer becoming active will typically be a problem in almost every case, since there are not many applications running that are not essential.

I wonder whether we could not reduce these values to something much lower, e.g.
2M for 128M RAM
1.5M for 64M RAM
(1M for 32M RAM is set already)

That would still be above the recommended values in [3], but increase the amount of "available" memory by 6.5 M on 64M devices.

Would you (or others) comment on this please, so I don't prepare a patch just to be told I overlooked something.



[1] https://github.com/openwrt/openwrt/commit/5c9cc7b7f8920944a413644e1c2ea23bfe655bcb
[2] https://github.com/openwrt/openwrt/commit/25dab5d217715300dc609df07b56e5b73cefdfc1
[3] https://elixir.bootlin.com/linux/v4.14.222/source/mm/page_alloc.c#L6974
-------------- next part --------------
A non-text attachment was scrubbed...
Name: openpgp-digital-signature.asc
Type: application/pgp-signature
Size: 834 bytes
Desc: not available
URL: <http://lists.openwrt.org/pipermail/openwrt-devel/attachments/20210227/d714adb4/attachment.sig>

More information about the openwrt-devel mailing list