環境:
RHEL 6.5 + Oracle 11.2.0.4 RAClinux
grep HugePage /proc/meminfo
cat /sys/kernel/mm/redhat_transparent_hugepage/enabledoracle
[root@jystdrac1 ~]# grep HugePage /proc/meminfo AnonHugePages: 690176 kB HugePages_Total: 3433 HugePages_Free: 383 HugePages_Rsvd: 23 HugePages_Surp: 0 [root@jystdrac1 ~]#
若上面的AnonHugePages > 0, 說明啓用了透明大頁。還能夠查看:app
[root@jystdrac1 ~]# cat /sys/kernel/mm/redhat_transparent_hugepage/enabled [always] madvise never
若上面擴號是在never的位置,說明禁用了透明大頁。測試
vi /etc/grub.conf 追加以下配置:ui
transparent_hugepage=never
重啓主機:this
shutdown -Fr now
再次查詢AnonHugePages發現透明大頁並無被禁用。spa
隨後查閱資料,參考MOS:ALERT: Disable Transparent HugePages on SLES11, RHEL6, RHEL7, OL6, OL7, and UEK2 and above (Doc ID 1557478.1)
文檔中提到兩種方法:code
To disable Transparent HugePages boot time either one of the following 2 methods may be used:server
Add the following to the kernel boot line in /etc/grub.conf (a symlink to /boot/grub/grub.conf) and reboot the server (this is the preferred method):文檔
transparent_hugepage=never
Once modified the line will read similar to the following example:title Oracle Linux Server (2.6.32-300.25.1.el6uek.x86_64)
root (hd0,0)
kernel /vmlinuz-2.6.32-300.25.1.el6uek.x86_64 ro root=LABEL=/ transparent_hugepage=never
initrd /initramfs-2.6.32-300.25.1.el6uek.x86_64.imgOR
Add the following lines in /etc/rc.local and reboot the server (this still can be done on Redhat 7 although rc.local is being deprecated):
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
Please change the file path for RHEL kernel to /sys/kernel/mm/redhat_transparent_hugepage/ accordingly.
發現以前用的方法,一樣也是MOS建議優先選擇的方法,就是將transparent_hugepage=never添加到/etc/grub.conf中,可是是加到kenel那一行後面的,實際嘗試後可行。
在節點2測試,公開 /etc/grub.conf 配置文件:
[root@jystdrac2 ~]# cat /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/vg_linuxbase-lv_root # 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 (2.6.32-431.el6.x86_64) root (hd0,0) kernel /vmlinuz-2.6.32-431.el6.x86_64 ro root=/dev/mapper/vg_linuxbase-lv_root rd_NO_LUKS LANG=en_US.UTF-8 rd_LVM_LV=vg_linuxbase/lv_root rd_NO_MD rd_LVM_LV=vg_linuxbase/lv_swap SYSFONT=latarcyrheb-sun16 crashkernel=auto KEYBOARDTYPE=pc KEYTABLE=us rd_NO_DM rhgb quiet transparent_hugepage=never initrd /initramfs-2.6.32-431.el6.x86_64.img
查看透明大頁也是關閉的:
[oracle@jystdrac2 ~]$ grep HugePage /proc/meminfo AnonHugePages: 0 kB HugePages_Total: 3433 HugePages_Free: 3433 HugePages_Rsvd: 0 HugePages_Surp: 0 [root@jystdrac2 ~]# cat /sys/kernel/mm/redhat_transparent_hugepage/enabled always madvise [never]