About Linux Transparent Big page detailed introduction _linux

Source: Internet
Author: User

Transparent Big Page Introduction

Some official presentations from transparent Huge pages:

Transparent Huge Pages (THP) are enabled by default in RHEL 6 for all applications. The kernel attempts to allocate hugepages whenever possible and any Linux process would receive 2MB pages if the mmap Regio N is 2MB naturally aligned. The main kernel address spaces itself is mapped with hugepages, reducing TLB pressure from kernel code. For general information on Hugepages, See:what are Huge Pages and What are the advantages of using them?

The kernel would always attempt to satisfy a memory using allocation. If no hugepages are available (due to non availability of physically, continuous memory for example) the kernel'll fall B Ack to the regular 4KB pages. THP are also swappable (unlike Hugetlbfs). This is achieved by breaking the huge page to smaller 4KB pages, which are then swapped out normally.

But to use hugepages effectively, the kernel must find physically continuous areas of memory big enough to satisfy the REQ Uest, and also properly aligned. For this, a khugepaged kernel thread has been added. This thread would occasionally attempt to substitute smaller pages being used the with a currently hugepage, allocation MA Ximizing THP usage.

In Userland, no modifications to the applications are necessary (hence transparent). But There are ways to optimize it use. For applications this want to use hugepages, use of posix_memalign () can also help ensure that large allocations are align Ed to huge page (2MB) boundaries.

Also, THP is only enabled for anonymous memory regions. There are plans to add support for TMPFS and page cache. THP tunables are found in The/sys tree under/sys/kernel/mm/redhat_transparent_hugepage.

See whether transparent large pages are enabled

1: Command cat/sys/kernel/mm/redhat_transparent_hugepage/enabled This command applies to the Red Hat Enterprise Linux System

[root@getlnx06 ~]# more/etc/issue
 
Red Hat Enterprise Linux Server Release 6.6 (Santiago)
 
Kernel \ R on a \m
 
[ root@getlnx06 ~]# cat/sys/kernel/mm/redhat_transparent_hugepage/enabled
 
[always] madvise never


2: Command cat/sys/kernel/mm/transparent_hugepage/enabled This command applies to other Linux systems

[root@getlnx06 ~]# cat/sys/kernel/mm/transparent_hugepage/enabled
 
always madvise [never]
 

When viewed using a command, if the output result is [always] the transparent page is enabled. [Never] indicates that transparent large page is disabled, [Madvise]

3: How to hugepages_total return 0, also means that the transparent large page disabled

[root@getlnx06 ~]# grep-i hugepages_total/proc/meminfo 
 
hugepages_total:0

4:cat/proc/sys/vm/nr_hugepages return 0 also means that the transparent large page is disabled.

[root@getlnx06 ~]# cat/proc/sys/vm/nr_hugepages 
 
0
 

Disable, enable transparent large page feature

Method 1: Set the/etc/grub.conf file to be disabled at system startup.

[root@getlnx06 ~]# vi/etc/grub.conf
# grub.conf generated by Anaconda
#
# # # * You don't have to rerun Grub after making changes to this file
# notice:you have a/boot partition. This means
so # all   kernel and initrd paths are relative to/boot/, eg.
#   Root (hd0,0)
#   kernel/vmlinuz-version ro root=/dev/mapper/volgroup--logvol0-logvol01
#   Initrd/initrd-[generic-]version.img
#boot =/dev/sda
default=0
timeout=5
splashimage= (hd0,0) /grub/splash.xpm.gz
hiddenmenu
title Red Hat Enterprise Linux 6 (2.6.32-504.el6.x86_64)
  root (hd0,0)
  kernel/vmlinuz-2.6.32-504.el6.x86_64 ro root=/dev/mapper/volgroup--logvol0-logvol01 rd_NO_LUKS LANG=en_US. UTF-8 rd_no_md sysfont=latarcyrheb-sun16 Crashkernel=auto rd_lvm_lv=volgroup-logvol0/logvol01 rd_LVM_LV= Volgroup-logvol0/logvol00 keyboardtype=pc keytable=us rd_no_dm rhgb quiet
  64.img
Transparent_hugepage=never

Method 2: Set the/etc/rc.local file

[root@getlnx06 ~]# vi/etc/rc.local
#!/bin/sh
# This script'll be executed *after* the other
init SCRI Pts.
# You can put your own initialization stuff in-if you don ' t # want to do the full
Sys V style init stuff.
 
Touch/var/lock/subsys/local
 
If test-f/sys/kernel/mm/redhat_transparent_hugepage/enabled then
 Echo never >/sys/kernel/mm/redhat_transparent_hugepage/enabled
fi

You can use the above configuration to reboot the operating system to take effect, and you may also run the following command without restarting the operating system.

You are must reboot your system for the setting to take effect, or run the following two echo lines to proceed with the instal L without rebooting:

[Root@getlnx06 ~]# echo never >/sys/kernel/mm/redhat_transparent_hugepage/enabled
[root@getlnx06 ~]# cat/sys/ kernel/mm/redhat_transparent_hugepage/enabled
always madvise [never]

Small Knowledge Points:

1: From Redhat 6, Oel 6, SLES One and UEK2 kernels, the system is running out of provincial capitals transparent Hugepages: Performance transparent large page (transparent Hugepages) and previous edition for improved memory management This is similar to the big page functionality in this. The main difference is: Transparent hugepages can be configured in real time, do not need to restart to be effective configuration;

2:transparent Huge pages are not supported in the 32-bit Rhel 6.

Transparent Huge Pages are not available on the 32-bit version of RHEL 6.

3:oracle official does not recommend that we use Redhat 6, Oel 6, SLES UEK2 Kernels when the open transparent page (transparent hugepages), because the transparent large page (transparent hugepages ) There are some problems:

A. Transparent large pages (transparent hugepages) in a RAC environment can cause unexpected node restarts, and performance problems;

B. In a stand-alone environment, transparent large pages (transparent hugepages) can also cause some exceptional performance problems;

Transparent hugepages memory are enabled by default with Red Hat Enterprise Linux 6, SUSE Linux Enterprise Server one, and O Racle Linux 6 with earlier releases Oracle Linux Unbreakable Enterprise Kernel 2 (UEK2) kernels. Transparent hugepages memory is disabled in later releases of Oracle Linux UEK2 Kernels. Hugepages can cause memory allocation delays during transparent. To avoid performance issues, Oracle recommends this you disable transparent the all Oracle Database hugepages. Oracle recommends that your instead use standard hugepages for enhanced performance. Transparent Hugepages memory differs from standard hugepages memory because the kernel khugepaged thread allocates memory dynamically during runtime. Standard hugepages Memory is pre-allocated at startup, and does don't change during runtime.
Starting with RedHat 6, Oel 6, SLES One and UEK2 kernels, transparent hugepages are implemented and enabled (default) in Attempt to improve the memory management. Transparent hugepages are similar to the hugepages this have been in available Linux previous. The main difference is this transparent hugepages are set up dynamically on run time by the khugepaged thread in Kerne The l while the regular hugepages had is preallocated at the "Boot up" time. Because transparent hugepages are known to cause unexpected node reboots and performance with RAC, Oracle problems Y advises to disable the use of transparent hugepages. In addition, transparent hugepages could cause problems even in a single-instance database environment with unexpected PERFO Rmance problems or delays. As such, Oracle recommends disabling transparent Hugepages on all Database servers running Oracle.

4: When installing Vertica analytic database, you must also turn off the transparent large page feature.

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.