星期三, 12月 16, 2015

檢測Linux 是否開啟 Transparent Huge Pages的一些方法

Oracle Linux will disable Transparent Huge Pages in the Unbreakable Enterprise Kernel, beginning with Quarterly Update 5 for the Unbreakable Enterprise Kernel, Release 2 (version 2.6.39-400.209.1).
è  Oracle Linux 6.4 以後UEK kernel 就自己disable Transparent Huge Pages

查看是否啟用Transparent Huge Pages
1:命令cat /sys/kernel/mm/redhat_transparent_hugepage/enabled 該命令適用於Red Hat Enterprise Linux系統
[root@getlnx06 ~]# more /etc/issue

Red Hat Enterprise Linux Server release 6.6 (Santiago)

Kernel \r on an \m

[root@getlnx06 ~]# cat /sys/kernel/mm/redhat_transparent_hugepage/enabled

[always] madvise never

2:命令cat /sys/kernel/mm/transparent_hugepage/enabled 該命令適用於其它Linux系統
但在Oracle Linux 會查不到此資訊
[root@getlnx06 ~]# cat /sys/kernel/mm/transparent_hugepage/enabled

always madvise [never]

[root@getlnx06 ~]#
使用命令查看時,如果輸出結果為[always]表示Transparent Huge Pages啟用了。[never]表示Transparent Huge Pages[madvise]表示

3:如何HugePages_Total返回0,也意味著Transparent Huge Pages禁用了
[root@rac1 ~]# grep -i HugePages_Total /proc/meminfo
HugePages_Total:       0

4cat /proc/sys/vm/nr_hugepages返回0也意味著Transparent Huge Pages禁用了。
[root@rac1 ~]# cat /proc/sys/vm/nr_hugepages
禁用、啟用Transparent Huge Pages功能

方法1:設置/etc/grub.conf檔,在系統啟動是禁用。
[root@getlnx06 ~]# vi /etc/grub.conf
# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE:  You have a /boot partition.  This means that
#          all kernel and initrd paths are relative to /boot/, eg.
#          root (hd0,0)
#          kernel /vmlinuz-version ro root=/dev/mapper/VolGroup--LogVol0-LogVol01
#          initrd /initrd-[generic-]version.img
#boot=/dev/sda
default=0
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
title Red Hat Enterprise Linux 6 (2.6.32-504.el6.x86_64)
        root (hd0,0)
        kernel /vmlinuz-2.6.32-504.el6.x86_64 ro root=/dev/mapper/VolGroup--LogVol0-LogVol01 rd_NO_LUKS LANG=en_US.UTF-8 rd_NO_MD SYSFONT=latarcyrheb-sun16 crashkernel=auto rd_LVM_LV=VolGroup-LogVol0/LogVol01 rd_LVM_LV=VolGroup-LogVol0/LogVol00  KEYBOARDTYPE=pc KEYTABLE=us rd_NO_DM rhgb quiet
        initrd /initramfs-2.6.32-504.el6.x86_64.img
transparent_hugepage=never

Ref:

沒有留言:

LinkWithin-相關文件

Related Posts Plugin for WordPress, Blogger...