[Reprint] Learn about the memory of large Linux pages

Source: Internet
Author: User

First, in explaining under what circumstances need to open large pages and why need to open a large page before understanding the next page of Linux related knowledge:
The following content is based on a 32-bit system, 4K of memory page size made calculation
1) Table of contents, used to store the page table location, a total of 1024 directory entry, each directory entry point to a page table location, each directory entry,4b size, table of contents 4b*1024=4k size
2) page table, used to store physical Address page start address, each page table entry is also 4b size, each page Table 1024 page table entry, so the size of a page table is 4 K, a total of 1024 page table, so the maximum size of the page table is 1024*4k=4m size
3) each page table entry points to a 4K physical memory page, so the page table can point to a total of physical memory size: 1024 (number of page tables) *1024 (entry per page table) *4k (a page table entry represents the page size) =4g
4) When the operating system maps virtual addresses to physical addresses, the 10 bits of the virtual address are used to index from the catalog table to one of 1024 page tables, and the 12-21 bits of the virtual address are used to index from the page table to one of the 10 page table entry. The starting address of the physical memory page is obtained from this page table entry, and then the 0-12 bits of the virtual address are used as offsets in the 4KB memory page, then the physical memory page start address plus the offset is the physical memory address that needs to be accessed.

Because the 32-bit operating system does not appear in the 4M page table, because a process cannot use 4GB of memory space, some of the space is reserved for use, such as the memory used to do the operating system kernel. and the page table entry is created when the process accesses a piece of memory, rather than creating it from the beginning.

Under 32-bit systems, a process that accesses 1GB of memory produces a 1M (1*1024*1024/4*4/1024/1024) page table, and if it is on a 64-bit system, it will grow to 2M.
It is easy to calculate that if an SGA is set to 60G, there are 1500 Oracle user processes (each of which has its own page table in Linux), and on 64-bit Linux systems, the largest page table takes up memory: 60*2*1500/1024=175g, yes, You're not mistaken, it's 175g!.
Second, why use large pages? When do I use large pages?
In Redhat Linux, the memory is divided in the form of pages, by default, each page is 4K, which means that if the physical memory is large, the mapping table entries will be very much, will affect the efficiency of the CPU retrieval. Because the memory size is fixed, in order to reduce the mapping table entries, you can only increase the size of the page. This increased memory page size in Linux 2.1, called the Big page; in as 3/4, called Hugepage
Configuring Hugepage in Linux can improve Oracle's performance and reduce page swapping for Oracle SGA, similar to Lagepage in Aix.
When you host the physical memory of 64G, set sga>=32g, it is recommended to open large pages

Hugepage Advantages

For larger system memory and SGA, using Hugepage can greatly improve Oracle database performance.

A, not swappable

No swap required. That is, there is no page because of insufficient memory space and there is a swap-out problem

B, Relief of TLB pressure

Reduce the pressure on the TLB, that is, reduce the CPU cache cached address mapping pressure. The number of virtual addresses managed is less due to the same memory size as the huge page is used.

The TLB entry can contain more address space, and the CPU's addressing capabilities are enhanced accordingly.

C, decreased page table overhead

Reduce page table load, for normal page, each entry need 64bytes to manage, for 50GB of memory, manage these entry, need 800MB size

(50*1024*1024) kb/4kb*64bytes/1024/1024=800mb.

d, eliminated page table lookup overhead

Eliminate Page Table lookup load

E, Faster overall memory performance

Improve the overall memory performance

[Reprint] Learn about the memory of large Linux pages

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.