mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-25 16:31:13 +00:00
25dab5d217
Signed-off-by: Felix Fietkau <nbd@nbd.name>
26 lines
492 B
Bash
Executable File
26 lines
492 B
Bash
Executable File
#!/bin/sh /etc/rc.common
|
|
# 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=1024
|
|
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
|
|
}
|