In this Document
Purpose |
Scope |
Details |
Introduction |
Common Misconceptions |
Regular Pages and HugePages |
HugePages in 2.4 Kernels |
Some HugePages Facts/Features |
Advantages of HugePages Over Normal Sharing Or AMM (see below) |
The Size of a HugePage |
HugePages Reservation |
HugePages and Oracle 11g Automatic Memory Management (AMM) |
What if Not Enough HugePages Configured? |
Parameters/Setup |
Notes on HugePages in General |
References |
This document describes the HugePages feature in the Linux kernel available for 32-bit and 64-bit architectures. There has been some confusion among the terms and uses related to HugePages. This document should clarify the misconceptions about the feature.
Information in this document is useful for Linux system administrators and Oracle database administrators working with system administrators.
This document covers information about HugePages concept that applies to very large memory systems for 32-bit and 64-bit architectures including some configuration information and references.
HugePages is a feature integrated into the Linux kernel with release 2.6. This feature basically provides the alternative to the 4K page size (16K for IA64) providing bigger pages.
Regarding the HugePages, there are some other similar terms that are being used like, hugetlb, hugetlbfs. Before proceeding into the details of HugePages, see the definitions below:
WRONG: HugePages is a method to be able to use large SGA on 32-bit VLM systems | RIGHT: HugePages is a method to have larger pages where it is useful for working with very large memory. It is both useful in 32- and 64-bit configurations |
WRONG: HugePages cannot be used without USE_INDIRECT_DATA_BUFFERS | RIGHT: HugePages can be used without indirect buffers. 64-bit systems does not need to use indirect buffers to have a large buffer cache for the RDBMS instance and HugePages can be used there too. |
WRONG: hugetlbfs means hugetlb | RIGHT: hugetlbfs is a filesystem type **BUT** hugetlb is the mechanism employed in the back where hugetlb can be employed WITHOUT hugetlbfs |
WRONG: hugetlbfs means hugepages | RIGHT: hugetlbfs is a filesystem type **BUT** HugePages is the mechanism employed in the back (synonymously with hugetlb) where HugePages can be employed WITHOUT hugetlbfs. |
This section aims to give a general picture about memory access in virtual memory systems and how pages are referenced.
When a single process works with a piece of memory, the pages that the process uses are reference in a local page table for the specific process. The entries in this table also contain references to the System-Wide Page Table which actually has references to actual physical memory addresses. So theoretically a user mode process (i.e. Oracle processes), follows its local page table to access to the system page table and then can reference the actual physical table virtually. As you can see below, it is also possible (and very common to Oracle RDBMS due to SGA use) that two different O/S processes can point to the same entry in the system-wide page table.
When HugePages are in the play, the usual page tables are employed. The very basic difference is that the entries in both process page table and the system page table has attributes about huge pages. So any page in a page table can be a huge page or a regular page. The following diagram illustrates 4096K hugepages but the diagram would be the same for any huge page size.
The HugePages feature is backported to some 2.4 kernels. Kernel versions 2.4.21-* has this feature (See Note 311504.1 for the distributions with 2.4.21 kernels) but it is implemented in a different way. The feature is completely available. The difference from 2.6 implementation is the organization within the source code and the kernel parameters that are used for configuring HugePages. See Parameters/Setup section below.
The size of a single HugePage varies according to:
The actual size of the HugePage on a specific system can be checked by:
$ grep Hugepagesize /proc/meminfo
The table below shows the sizes of HugePages on different configurations. Note that these are general numbers taken from the most recent versions of the kernels. For a specific kernel source package, you can check for the HPAGE_SIZE macro value (based on HPAGE_SHIFT) for a different (more recent) kernel source tree.
HW Platform | Source Code Tree | Kernel 2.4 | Kernel 2.6 and later |
Linux x86 (IA32) | i386 | 4 MB | 2 MB |
Linux x86-64 (AMD64, EM64T) | x86_64 | 2 MB | 2 MB |
Linux Itanium (IA64) | ia64 | 256 MB | 256 MB |
IBM Power Based Linux (PPC64) | ppc64/powerpc | N/A ** | 16 MB |
IBM zSeries Based Linux | s390 | N/A | 1 MB |
IBM S/390 Based Linux | s390 | N/A | N/A |
* Some older packaging for the 2.6.5 kernel on SLES8 (like 2.6.5-7.97) can have 2 MB Hugepagesize.
** Oracle RDBMS is also not certified in this configuration. See Document 341507.1
The HugePages reservation feature is fully implemented in 2.6.17 kernel, and thus EL5 (based on 2.6.18) has this feature. The alloc_huge_page() is improved for this. (See kernel source mm/hugetlb.c)
From /usr/share/doc/kernel-doc-2.6.18/Documentation/vm/hugetlbpage.txt:
HugePages_Rsvd is short for "reserved," and is the number of hugepages for which a commitment to allocate from the pool has been made, but no allocation has yet been made. It's vaguely analogous to overcommit.
This feature in the Linux kernel enables the Oracle Database to be able to allocate hugepages for the sublevels of the SGA on-demand. The same behaviour is expected for various Oracle Database versions that are certified on EL5.
The AMM and HugePages are not compatible. One needs to disable AMM on 11g to be able to use HugePages. See Document 749851.1 for further information.
Configuring your Linux OS for HugePages is a delicate process where if you do not configure properly, the system may experience serious problems. If you do not have enough HugePages configured you may encounter:
To avoid / help with such situations Bug 10153816 was filed to introduce a database initialization parameter in 11.2.0.2 (use_large_pages) to help manage which SGAs will use huge pages and potentially give warnings or not start up at all if they cannot get those pages.
The following configurations are general guidelines to configure HugePages for more than one Oracle RDBMS instance. If you are looking for use of HugePages on 32-bit Linux please refer below as appropriate:
Kernel Version 2.4
The kernel parameter used for HugePages is vm.hugetlb_pool which is based on MB of memory. RHEL3, Asianux 1.0, SLES8 (Service Pack 3 and over) are examples of distributions with the 2.4 kernels with HugePages support. For the configuration, follow steps below:
1. Start database instance(s)
2. Calculate hugetlb_pool using script from Note 401749.1
3. Shutdown database instances
4. Set kernel parameter:
# sysctl -w vm.hugetlb_pool=<value from above>
and make sure that the parameter is persistent to reboots. e.g. On Asianux 1.0 by editing /etc/sysctl.conf adding/modifying as below:
vm.hugetlb_pool=<value from above>
5. Check available hugepages:
$ grep Huge /proc/meminfo
6. Restart database instances
7. Check available hugepages:
$ grep Huge /proc/meminfo
Notes:
Kernel Version 2.6
The kernel parameter used for HugePages is vm.nr_hugepages which is based on the number of the pages. SLES9, RHEL4 and Asianux 2.0 are examples of distributions with the 2.6 kernel. For the configuration, follow steps below:
1. Start database instance(s)
2. Calculate nr_hugepages using script from Document 401749.1
3. Shutdown database instances
4. Set kernel parameter:
# sysctl -w vm.nr_hugepages=<value from above>
and make sure that the parameter is persistent to reboots. e.g. On SLES9:
# chkconfig boot.sysctl on
5. Check available hugepages:
$ grep Huge /proc/meminfo
6. Restart database instances
7. Check available hugepages:
$ grep Huge /proc/meminfo
Notes: