重庆思庄Oracle、Redhat认证学习论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 3367|回复: 0
打印 上一主题 下一主题

[系统管理] 在红帽linux(rhel)7以上版本禁用透明大页内存的方法

[复制链接]
跳转到指定楼层
楼主
发表于 2017-6-16 16:20:11 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

以下为红帽官方提供的方法:

How to disable transparent hugepages (THP) on Red Hat Enterprise Linux 7
$ Solution 已验证  - 已更新2017年六月2日23:54 -  English   
环境
Red Hat Enterprise Linux 7
transparent hugepages (THP)
tuned

问题
How to disable transparent hugepages (THP) on Red Hat Enterprise Linux 7
Disabling transparent hugepages (THP) on Red Hat Enterprise Linux 7 is not taking effect.

决议
Follow the steps below
1.Add the "transparent_hugepage=never" kernel parameter option to the grub2 configuration file.
Append or change the "transparent_hugepage=never" kernel parameter
on the GRUB_CMDLINE_LINUX option in /etc/default/grub file. Only include the parameter once.
vim /etc/default/grub

GRUB_CMDLINE_LINUX="rd.lvm.lv=rhel/root rd.lvm.lv=rhel/swap ... transparent_hugepage=never"
2.Rebuild the /boot/grub2/grub.cfg file by running the grub2-mkconfig -o command as follows:
  Please ensure to take a backup of the existing /boot/grub2/grub.cfg before rebuilding.
  
   On BIOS-based machines: ~]# grub2-mkconfig -o /boot/grub2/grub.cfg
   On UEFI-based machines: ~]# grub2-mkconfig -o /boot/efi/EFI/redhat/grub.cfg
3.Reboot the system and verify option has been added
  Reboot the system
  # shutdown -r now
  Verify the parameter is set correctly
  # cat /proc/cmdline
  正确的,应该含 transparent_hugepage=never
  

If Transparent Huge Pages (THP) is still not disabled, continue and use one of the options below.
Option 1: (Recommended) create a customized tuned profile with disabled THP
With this resolution we will create a customized version of the currently running profile. The customized version will disable THP.
Find out which profile is active, create a copy.
In the following example we currently use the throughput-performance profile:

  # tuned-adm active
  Current active profile: throughput-performance
  To create customized profile, create a new directory in /etc/tuned directory with desired profile name.
  # mkdir /etc/tuned/myprofile-nothp
  Then create a new tuned.conf file for myprofile-nothp, and insert the new tuning info:
   
  # cat /etc/tuned/myprofile-nothp/tuned.conf
  [main]
  include= throughput-performance
  [vm]
  transparent_hugepages=never
  Make the script executable:
  # chmod +x /etc/tuned/myprofile-nothp/tuned.conf
  Enable myprofile like so:
  # tuned-adm profile myprofile-nothp
  This change will immediately take effect and persist reboots.

  To verify if THP are disabled or not, run below command:
  # cat /sys/kernel/mm/transparent_hugepage/enabled

  Option 2: (Alternative) Disable tuned services
  This resolution will disable the tuned services.

  # systemctl stop tuned
  # systemctl disable tuned
  或者
  # tuned-adm off
  Now add "transparent_hugepage=never" kernel parameter in grub2 configuration file as explained in steps 1-3 above.
  Reboot the server for changes to take effect.
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 支持支持 反对反对
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|手机版|小黑屋|重庆思庄Oracle、Redhat认证学习论坛 ( 渝ICP备12004239号-4 )

GMT+8, 2024-11-25 07:39 , Processed in 0.122820 second(s), 21 queries .

重庆思庄学习中心论坛-重庆思庄科技有限公司论坛

© 2001-2020

快速回复 返回顶部 返回列表