禁用透明大页

方法一:
缺省启用:[always] — 表明启用了透明大页
[root@rhel-6 redhat_transparent_hugepage]# cat /sys/kernel/mm/redhat_transparent_hugepage/enabled
[always] madvise never

禁用状态:
[root@rhel-6 redhat_transparent_hugepage]# cat /sys/kernel/mm/redhat_transparent_hugepage/enabled
always madvise [never]

方法二:
[root@rhel-6 redhat_transparent_hugepage]#  grep AnonHugePages /proc/meminfo
AnonHugePages:    143360 kB
如果 AnonHugePages > 0 同样表示启用了透明大页;

—-如何禁用透明大页:
方法一(优先选择):

在 /etc/grub.conf 中添加一行记录:

transparent_hugepage=never

然后重启

方法二:
配置/etc/rc.local 然后重启服务器:
if test -f /sys/kernel/mm/redhat_transparent_hugepage/enabled; then
echo never > /sys/kernel/mm/redhat_transparent_hugepage/enabled
fi
if test -f /sys/kernel/mm/redhat_transparent_hugepage/defrag; then
echo never > /sys/kernel/mm/redhat_transparent_hugepage/defrag
fi

 

 

修改swappiness值为0,即最大限度使用内存

 

[root@localhost ~]# cat /proc/sys/vm/swappiness
30

Leave a Reply

Your email address will not be published. Required fields are marked *