查看透明大頁內(nèi)存是否開啟
cat /sys/kernel/mm/transparent_hugepage/enabled
返回
[always] madvise never #如果輸出結(jié)果為[always]表示透明大頁啟用了断楷。[never]表示透明大頁禁用
關(guān)閉透明大頁內(nèi)存操作步驟
第一步
在GRUB_CMDLINE_LINUX加入選項(xiàng) transparent_hugepage=never
echo 'GRUB_CMDLINE_LINUX="transparent_hugepage=never"' >> /etc/default/grub
第二步
重新生成grub配置文件
輸入命令
grub2-mkconfig -o /boot/grub2/grub.cfg
返回
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-3.10.0-693.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-693.el7.x86_64.img
Found linux image: /boot/vmlinuz-0-rescue-bdd94cf792bd4ac6a087ff2542ba6cd0
Found initrd image: /boot/initramfs-0-rescue-bdd94cf792bd4ac6a087ff2542ba6cd0.img
done
輸入命令
grub2-mkconfig -o /boot/efi/EFI/redhat/grub.cfg
返回
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-3.10.0-693.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-693.el7.x86_64.img
Found linux image: /boot/vmlinuz-0-rescue-bdd94cf792bd4ac6a087ff2542ba6cd0
Found initrd image: /boot/initramfs-0-rescue-bdd94cf792bd4ac6a087ff2542ba6cd0.img
done
第三步
重啟操作系統(tǒng)
reboot
查看是否生效:
cat /proc/cmdline
返回
BOOT_IMAGE=/vmlinuz-3.10.0-693.el7.x86_64 root=/dev/mapper/rhel-root ro transparent_hugepage=never
或者
grep Huge /proc/meminfo
返回
AnonHugePages: 0 kB #與透明大頁有關(guān)迎捺,透明大頁關(guān)閉踩寇,則顯示0
HugePages_Total: 0
HugePages_Free: 0
HugePages_Rsvd: 0
HugePages_Surp: 0
Hugepagesize: 2048 kB
或者
cat /sys/kernel/mm/transparent_hugepage/enabled
返回
always madvise [never]