Oracle Linux: 如何在Oracle Linux 7上禁用透明HugePages (Doc ID 2336923.1)

Oracle Linux: How To Disable Transparent HugePages On Oracle Linux 7 (Doc ID 2336923.1)

APPLIES TO:

Linux OS - Version Oracle Linux 7.3 with Unbreakable Enterprise Kerne [4.1.12] and later
Information in this document applies to any platform.

GOAL

Disable the transparent hugepages (THP) feature to improve system stability and performance.
禁用透明hugepages(THP)功能以提高系统稳定性和性能。

SOLUTION

To keep THP disabled across a reboot, Please perform any one of the following action plans  要在重新启动期间禁用THP,请执行以下任何一项行动计划

 Use a systemd(1) service to disable transparent hugepages

1.  Create the systemd(1) service definition file /etc/systemd/system/disable-thp.service similar to this:

    创建类似于以下内容的systemd(1)服务定义文件/etc/systemd/system/disable-thp.service

[Unit]
Description=Disable Transparent Huge Pages (THP)

[Service]
Type=simple
ExecStart=/bin/sh -c "echo 'never' >/sys/kernel/mm/transparent_hugepage/enabled && echo 'never' >/sys/kernel/mm/transparent_hugepage/defrag"

[Install]
WantedBy=multi-user.target

2.  Enable the new service to run automatically:  启用新服务以自动运行

# systemctl daemon-reload
# systemctl start disable-thp
# systemctl enable disable-thp
# systemctl status disable-htp

Disable transparent hugepages via the Linux kernel command line  通过Linux内核命令行禁用透明的hugepages

1.  Add the clause "transparent_hugepages=never" to the GRUB_CMDLINE_LINUX entry of /etc/default/grub, like this:

1. 将子句"transparent_hugepages=never"添加到/etc/default/grubGRUB_CMDLINE_LINUX条目中,如下所示:

# /etc/default/grub
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
GRUB_DEFAULT=saved
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL_OUTPUT="console"
GRUB_CMDLINE_LINUX="elevator=deadline audit=1 crashkernel=auto rd.lvm.lv=rootvg/rootlv rd.lvm.lv=rootvg/swaplv rd.lvm.lv=rootvg/usrlv transparent_hugepage=never"
GRUB_DISABLE_RECOVERY="true"

 2.  Backup the GRUB configuration file and generate a new file to incorporate the change: 

 2. 备份GRUB配置文件并生成一个新文件以合并更改:

# cp -pv /boot/grub2/grub.cfg /boot/grub2/grub.cfg-bkp
# grub2-mkconfig -o /boot/grub2/grub.cfg

3.  Reboot the server to activate the change.  重新启动服务器以激活更改。

# reboot

4.  Verify the correction is persistent:  验证

# cat /sys/kernel/mm/transparent_hugepage/enabled
always madvise [never]

 

REFERENCES

NOTE:2279458.1 - Transparent Hugepage is not getting disabled
NOTE:1500235.1 - How To Collect an Sosreport on Oracle Linux

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值