某Linux系统安装脚本判断hugepages开启有BUG,导致小内存机器也强行打开2.5G hugepages,导致服务器内核崩溃无法启用开机
某Linux系统安装脚本判断hugepages开启有BUG,导致小内存机器也强行打开2.5G hugepages,导致服务器内核崩溃无法启用开机某些软件错误判断内存引起错误打开hugepages引起内核崩溃无法开机的BUG修复
出错相关代码,请进行修正改为-gt判断
if [[ $(grep MemTotal /proc/meminfo | awk '{print $2}') > 3500000 ]]; then
echo "[*] Enabling huge pages"
echo "[*] 启用 huge pages"
echo "vm.nr_hugepages=$((1168+$(nproc)))" | sudo tee -a /etc/sysctl.conf
sudo sysctl -w vm.nr_hugepages=$((1168+$(nproc)))
fi
修复后代码
if [[ $(grep MemTotal /proc/meminfo | awk '{print $2}') -gt 3500000 ]]; then
echo "[*] Enabling huge pages"
echo "[*] 启用 huge pages"
echo "vm.nr_hugepages=$((1168+$(nproc)))" | sudo tee -a /etc/sysctl.conf
sudo sysctl -w vm.nr_hugepages=$((1168+$(nproc)))
fi
页:
[1]