查看透明大页内存是否开启
cat /sys/kernel/mm/transparent_hugepage/enabled
返回
[always] madvise never #如果输出结果为[always]表示透明大页启用了。[never]表示透明大页禁用
关闭透明大页内存操作步骤
第一步
在GRUB_CMDLINE_LINUX加入选项 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
第三步
重启操作系统
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 #与透明大页有关,透明大页关闭,则显示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]
网友评论