标签:virt 整理 没有 case rtu hugepage crash profile grub2
#这里只针对CentOs7系统,内核3.10,grub2#!/bin/bash
case $1 in
start)
if [ -d /sys/kernel/mm/transparent_hugepage ]; then
thp_path=/sys/kernel/mm/transparent_hugepage
elif [ -d /sys/kernel/mm/redhat_transparent_hugepage ]; then
thp_path=/sys/kernel/mm/redhat_transparent_hugepage
else
return 0
fi
echo ‘never‘ > ${thp_path}/enabled
echo ‘never‘ > ${thp_path}/defrag
re=‘^[0-1]+$‘
if [[ $(cat ${thp_path}/khugepaged/defrag) =~ $re ]]
then
#RHEL 7
echo 0 > ${thp_path}/khugepaged/defrag
else
#RHEL 6
echo ‘no‘ > ${thp_path}/khugepaged/defrag
fi
unset re
unset thp_path
;;
esac
mkdir /etc/tuned/no-thp -p
echo -e "[main]\ninclude=virtual-guest\n[vm]\ntransparent_hugepages=never" >/etc/tuned/no-thp/tuned.conf
tuned-adm profile no-thp
cat /sys/kernel/mm/transparent_hugepage/enabled
cat /sys/kernel/mm/transparent_hugepage/defrag
#都是always madvise [never]才可以。这个是不用重启机器。
标签:virt 整理 没有 case rtu hugepage crash profile grub2
原文地址:http://blog.51cto.com/laodou/2326610