Linux - (Huge|Large) pages

> Operating System - Kernel (Windows, Unix, Linux) > Linux / Unix

1 - About

Large page also known as “huge pages”.

Advertising

3 - Kernel Configuration

If large pages are supported by the kernel, there should be special files in the /proc directory that indicate the number and size of the large pages.

Since large pages must be allocated on a contiguous memory space, the actual large page size allocated may be smaller than requested. Also, the large page size itself is not configurable.

If PAM (Pluggable Authentication Modules) is enabled, you may need to modify the /etc/security/limits.conf file to increase the memlock limit. By default, the limit is 32 KB.

4 - How to

4.1 - get the number and size of the allocated large pages

4.1.1 - meminfo

With proc/meminfo:

[[email protected] ~]$ cat /proc/meminfo|grep Huge
HugePages_Total:   10000
HugePages_Free:     9248
HugePages_Rsvd:       17
HugePages_Surp:        0
Hugepagesize:       2048 kB

where:

  • HugePages_Total gives the total huge page
  • Hugepagesize indicates the system's fixed large page size.

The below output indicates that you have 10000 large pages, each of the size 2048 kb and then a total of 2 GB

4.1.2 - sysctl.conf

With sysctl.conf, we can see the number of huge pages:

cat /etc/sysctl.conf|grep huge
#vm.nr_hugepages = 10000
vm.nr_hugepages = 205100
Advertising

4.2 - set the total number and size of the large pages

4.2.1 - proc

On 2.6.x systems, the /proc/sys/vm/nr_hugepages file indicates the total number of large pages.

You can change the total number and size of the large pages by changing the contents of those files.

Example:

[[email protected] ~]$ cat /proc/sys/vm/nr_hugepages
10000
[[email protected] ~]$ echo 32 > /proc/sys/vm/nr_hugepages

4.2.2 - sysctl.conf

You can configure and activate the number of large pages by setting the nr_hugepages parameter in the /etc/sysctl.conf file.

For example:

vm.nr_hugepages = 410200

5 - Documentation / Reference

os/linux/large_page.txt · Last modified: 2018/09/16 12:42 by gerardnico