vm.min_free_kbytes seems very big

Felix Fietkau nbd at nbd.name
Sat Feb 27 10:57:29 EST 2021


Hi Adrian,

On 2021-02-27 16:40, Adrian Schmutzler wrote:
> 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.
The reason why these values are so high is the fact that network buffer
allocations during routing/bridging tend to be almost entirely atomic.
Under load, using the "recommended" values can easily lead to lots of
allocation failures in NAPI poll functions, because the context doing
the atomic allocation cannot free up reclaimable memory by itself.

Maybe we should use custom settings on devices with ath10k (which is a
really nasty RAM hog).

- Felix



More information about the openwrt-devel mailing list