2007-05-10 10:07:38 +00:00
|
|
|
#!/bin/sh /etc/rc.common
|
2013-12-09 11:30:14 +00:00
|
|
|
# Copyright (C) 2006 OpenWrt.org
|
2007-05-10 10:07:38 +00:00
|
|
|
|
2013-03-26 10:02:58 +00:00
|
|
|
START=11
|
2016-08-01 12:52:13 +00:00
|
|
|
|
|
|
|
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
|
2016-09-16 14:44:28 +00:00
|
|
|
val=1024
|
2016-08-01 12:52:13 +00:00
|
|
|
else
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
sysctl -qw vm.min_free_kbytes="$val"
|
|
|
|
}
|
|
|
|
|
2007-05-10 10:07:38 +00:00
|
|
|
start() {
|
2016-08-01 12:52:13 +00:00
|
|
|
set_vm_min_free
|
2015-07-07 13:47:23 +00:00
|
|
|
for CONF in /etc/sysctl.conf /etc/sysctl.d/*.conf; do
|
|
|
|
[ -f "$CONF" ] && sysctl -p "$CONF" -e >&-
|
|
|
|
done
|
2007-05-10 10:07:38 +00:00
|
|
|
}
|