root用户下
在vi /etc/rc.local最后添加如下代码
if test -f /sys/kernel/mm/transparent_hugepage/enabled; then echo never > /sys/kernel/mm/transparent_hugepage/enabled fi if test -f /sys/kernel/mm/transparent_hugepage/defrag; then echo never > /sys/kernel/mm/transparent_hugepage/defrag fi
立即生效需要执行下,使用命令 sh /etc/rc.local 查看修改结果: cat /sys/kernel/mm/transparent_hugepage/enabled always madvise [never]