with 5c9cc7b7f8920944a413644e1c2ea23bfe655bcb we changed the default value of 'vm.min_free_kbytes' from ~650 to 4096 kilobytes on 32MiB-RAM-devices. This makes them hardly useable with a lot of OOM-crashes.
Change that and use 1024 kilobytes for 32MiB-RAM-devices. For devices with more than 32MiB RAM we keep the behaviour / the values. While we are at it, localize vars and read the memory without AWK/nonforking. changes v1 -> v2: (suggestions from Felix Fietkau, Rafał Miłecki) - keep -quiet option from sysctl - use 1024 kilobyte on 32MiB-devices instead of the kernel default - consistently use unit [MiB] --- package/base-files/files/etc/init.d/sysctl | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/package/base-files/files/etc/init.d/sysctl b/package/base-files/files/etc/init.d/sysctl index a0daec0..7a16e01 100755 --- a/package/base-files/files/etc/init.d/sysctl +++ b/package/base-files/files/etc/init.d/sysctl @@ -4,16 +4,20 @@ START=11 set_vm_min_free() { - mem="$(grep MemTotal /proc/meminfo | awk '{print $2}')" - if [ "$mem" -gt 65536 ]; then # 128M + local mem value + + read -r _ mem _ </proc/meminfo + + if [ "$mem" -gt 65536 ]; then # 128MiB val=16384 - elif [ "$mem" -gt 32768 ]; then # 64M + elif [ "$mem" -gt 32768 ]; then # 64MiB val=8192 - elif [ "$mem" -gt 16384 ]; then # 32M - val=4096 + elif [ "$mem" -gt 16384 ]; then # 32MiB + val=1024 else return fi + sysctl -qw vm.min_free_kbytes="$val" } -- 2.7.4 _______________________________________________ Lede-dev mailing list Lede-dev@lists.infradead.org http://lists.infradead.org/mailman/listinfo/lede-dev