diff options
Diffstat (limited to 'package/base-files/files')
-rwxr-xr-x | package/base-files/files/etc/init.d/sysctl | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/package/base-files/files/etc/init.d/sysctl b/package/base-files/files/etc/init.d/sysctl index 2dfbaf7a6e..a0daec071e 100755 --- a/package/base-files/files/etc/init.d/sysctl +++ b/package/base-files/files/etc/init.d/sysctl @@ -2,7 +2,23 @@ # Copyright (C) 2006 OpenWrt.org START=11 + +set_vm_min_free() { + mem="$(grep MemTotal /proc/meminfo | awk '{print $2}')" + if [ "$mem" -gt 65536 ]; then # 128M + val=16384 + elif [ "$mem" -gt 32768 ]; then # 64M + val=8192 + elif [ "$mem" -gt 16384 ]; then # 32M + val=4096 + else + return + fi + sysctl -qw vm.min_free_kbytes="$val" +} + start() { + set_vm_min_free for CONF in /etc/sysctl.conf /etc/sysctl.d/*.conf; do [ -f "$CONF" ] && sysctl -p "$CONF" -e >&- done |