Disable transparent HugePages


1. Check Transparent HugePages enabled
Red Hat Enterprise Linux kernel:

# cat /sys/kernel/mm/redhat_transparent_hugepage/enabled


Other kernel:

CAT # / sys / kernel / mm / transparent_hugepage / Enabled 
[Always] madvise Never << ---- [Always] mark THP is enabled  
if you remove Transparent HugePages from the kernel, then neither / sys / kernel / mm / transparent_hugepage 
no / sys / kernel / mm / redhat_transparent_hugepage files exist.


2. Disable transparent hugepages:

OL 7:

1.编辑tuned.conf
[root@prodb ~]# uname -r
4.1.12-112.16.4.el7uek.x86_64
[root@prodb ~]# cat /sys/kernel/mm/transparent_hugepage/enabled 
always madvise [never]

[root@prodb ~]# cd /usr/lib/tuned/throughput-performance/
[root@prodb ~]# cp tuned.conf tuned.conf.bak
[vm]
 transparent_hugepages=always
 to 
[vm]
transparent_hugepages=never
2.重启
# shutdown -r now
3.校验
[root@prodb ~]# uname -r
4.1.12-112.16.4.el7uek.x86_64
[root@prodb ~]# cat /sys/kernel/mm/transparent_hugepage/enabled 
always madvise [never]  <<--- THP Disabled
# cat /proc/cmdline
BOOT_IMAGE = / vmlinuz-4.1.12-112.16.4.el7uek.x86_64 .... transparent_hugepage = never 
, if not in effect, set as follows: 
1. Check Profile 
# Active Tuned-ADM 
Current Active Profile: Guest-<< Virtual IS the Guest at the Virtual---- the Active Profile 
2. modify tuned.conf 
#cp /usr/lib/tuned/virtual-guest/tuned.conf /usr/lib/tuned/virtual-guest/tuned.conf.bkp_original 
add the following SUMMARY: 
[main] 
the include throughput-Performance = 
[VM] 
transparent_hugepages = Never 
3. restart 
# -R & lt now the shutdown 
4. check 
[prodb the root @ ~] # the uname -R & lt 
[prodb the root @ ~] # CAT / SYS / Kernel / mm / transparent_hugepage / Enabled  
# CAT / proc / cmdline


RHEL 7:

1. Edit grub.conf 
added transparent_hugepage = never end in GRUB_CMDLINE_LINUX  
#vim / etc / default / GRUB 
GRUB_CMDLINE_LINUX = "rd.lvm.lv RHEL = / = RHEL rd.lvm.lv the root / ... transparent_hugepage = never the swap" 
2 GRUB .Rebuild 
the On the BIOS-based Machines: ~] # grub2 -o-mkconfig /boot/grub2/grub.cfg 
the On the UEFI-based Machines: ~] # grub2 -o-mkconfig / Boot / EFI / the EFI / RedHat / GRUB. CFG 
3.reboot 
# -R & lt now the shutdown 
4. check 
# CAT / proc / cmdline 
BOOT_IMAGE = / vmlinuz transparent_hugepage = Never-4.1.12-112.16.4.el7uek.x86_64 .... 
If not in effect, set as follows : 
1. check Profile 
# Active Tuned-ADM 
2. custom Profile 
# mkdir / etc / Tuned / MyProfile-nothp  
# CAT /etc/tuned/myprofile-nothp/tuned.conf
[main] 
the include throughput-Performance =
[vm]
transparent_hugepages=never
3.激活配置文件
# chmod +x /etc/tuned/myprofile-nothp/tuned.conf
# tuned-adm profile myprofile-nothp
4.重启校验
# shutdown -r now
# cat /sys/kernel/mm/transparent_hugepage/enabled
5.关闭服务
# systemctl stop tuned
# systemctl disable tuned
# systemctl stop ktune
# systemctl disable ktune
或者
# tuned-adm off
THP status in other UEK kernel versions
UEK3 disabled by default  
[root@ol6 ~]# grep -i CONFIG_TRANSPARENT_HUGEPAGE /boot/config-3.8.13-118.6.2.el6uek.x86_64
# CONFIG_TRANSPARENT_HUGEPAGE is not set  
UEK4 enabled by default
[root@ol7 ~]# grep -i CONFIG_TRANSPARENT_HUGEPAGE /boot/config-4.1.12-37.2.2.el7uek.x86_64
CONFIG_TRANSPARENT_HUGEPAGE=y
CONFIG_TRANSPARENT_HUGEPAGE_ALWAYS=y


RHEL 6 or earlier

Enabled to [Always] 
# CAT / SYS / Kernel / mm / [hedhat_] transparent_hugepage / Enabled 
[Always] Never 
or visit the following 
# grep AnonHugePages / proc / meminfo 
AnonHugepages: xxxx kB 
requirements XXXX> 0 
disabled as [never] 
CAT # / SYS / Kernel / mm / [hedhat_] transparent_hugepage / Enabled 
Always [Never] 
disable Huge 
1. edit the grub.conf  
#vi the /etc/grub.conf  
Kernel /vmlinuz-2.6.32-300.25.1.el6uek.x86_64 ro root = LABEL = / transparent_hugepage = never 
or 
#vi /etc/rc.local 
IF Test -f / SYS / Kernel / mm / transparent_hugepage / Enabled; the then 
   echo Never> / SYS / Kernel / mm / transparent_hugepage / Enabled 
Fi 
IF Test -f / sys / kernel / mm / transparent_hugepage / defrag; then
   Never echo> / SYS / Kernel / mm / transparent_hugepage / Defrag 
Fi 
2. restart commencement


Quote:

ALERT: Disable Transparent HugePages on SLES11, RHEL6, RHEL7, OL6, OL7, and UEK2 and above (文档 ID 1557478.1)  
NOTE:2066217.1 - Oracle Linux 7 - How to disable Transparent HugePages for RHCK kernel?  
(How to disable transparent hugepages (THP) on Red Hat Enterprise Linux 7)


Guess you like

Origin blog.51cto.com/hunt1574/2438025