From: Zhuo Fu <quic_...@quicinc.com>

set proper min_free_kbytes for small RAM device to avoid
OOM during device boot up.

Signed-off-by: shoudil <quic_shou...@quicinc.com>
---
 package/base-files/files/etc/init.d/sysctl | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/package/base-files/files/etc/init.d/sysctl 
b/package/base-files/files/etc/init.d/sysctl
index 4db56444c7..742a978cee 100755
--- a/package/base-files/files/etc/init.d/sysctl
+++ b/package/base-files/files/etc/init.d/sysctl
@@ -7,12 +7,14 @@ apply_defaults() {
        local mem="$(awk '/^MemTotal:/ {print $2}' /proc/meminfo)"
        local min_free frag_low_thresh frag_high_thresh
 
-       if [ "$mem" -gt 65536 ]; then # 128M
+       if [ "$mem" -gt 262144 ]; then # 512M
                min_free=16384
-       elif [ "$mem" -gt 32768 ]; then # 64M
-               min_free=8192
+       elif [ "$mem" -gt 131072 ]; then # 256M
+               min_free=3072
+       elif [ "$mem" -gt 32768 ]; then # 64M or 128M
+               min_free=512
        else
-               min_free=1024
+               min_free=512
                frag_low_thresh=393216
                frag_high_thresh=524288
        fi
-- 
2.25.1


_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to