• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

CentOS / RHEL 6,7 : How to configure hugepages

by admin

What is hugepages

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. HugePages is a method to have larger pages where it is useful for working with very large memory.

Configure hugepages by using the kernel tunable vm.nr_hugepages

1. Edit /etc/sysctl.conf file and specify the number of hugepages in the nr_hugepages parameter. The entry makes the parameter persist across reboots but does not come into effect until you run the ‘sysctl -p’ command described in the next step.

# vi /etc/sysctl.conf
vm.nr_hugepages = 10

2. Execute ‘sysctl -p’ command to enable the hugepages parameter.

# sysctl -p
...
vm.nr_hugepages = 10
Note : It’s recommended to restart the system after configuring hugepages as the chances of having free contiguous memory (for hugepages allocation) is much greater when a system is started.

Verify

To verify the hugepages parameter setting, use either for the 2 methods given below:
1. check for the file /proc/meminfo :

# cat /proc/meminfo | grep Huge
HugePages_Total:    10
HugePages_Free:     10
HugePages_Rsvd:      0
Hugepagesize:     2048 kB

where:
HugePages_Total – the size of the pool of huge pages.
HugePages_Free – the number of huge pages in the pool that are not yet used.
HugePages_Rsvd – the number of huge pages committed to be allocated from the pool but no allocation has yet been made.
HugePages_Surp – is short for “surplus,” and is the number of huge pages in the pool above the value in /proc/sys/vm/nr_hugepages. The maximum number of surplus huge pages is controlled by /proc/sys/vm/nr_overcommit_hugepages.

2. Use the sysctl command :

# sysctl a | grep nr_hugepages
vm.nr_hugepages = 10

How to calculate hugepages

Used hugepages can be calculated by below method. Use the values from the outpur of ‘cat /proc/meminfo’ in the formula below.

HugePages_Total - HugePages_Free = HugePages_Used
RHEL/CentOS 6,7 : How to caculate the size of hugepage used by a specified process/application

Filed Under: CentOS/RHEL 7, Linux

Some more articles you might also be interested in …

  1. lvcreate/lvremove Failed with Error “Can’t remove merging snapshot logical volume”
  2. CentOS / RHEL 6 : How to force a NTP sync with the NTP server(s)
  3. ncat Command Examples in Linux
  4. guake: command not found
  5. flameshot Command Examples in Linux
  6. The ultimate Linux interview questions : swap
  7. How to Reserve a Port Range for a Third Party Application in CentOS/RHEL
  8. Linux OS Service ‘sshd’
  9. How to use perf tool for tracing similar to dtrace
  10. lrunzip: command not found

You May Also Like

Primary Sidebar

Recent Posts

  • pw-cat Command Examples in Linux
  • pvs: command not found
  • pulseaudio: command not found
  • pulseaudio Command Examples in Linux

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright