• 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. How to Create a Bridge Interface Using nmcli in CentOS/RHEL 7 and 8
  2. Apache HTTP server – most commonly used configuration directives
  3. CentOS/RHEL: “id” command doesn’t list the Group Name against GID for LDAP Users
  4. How to configure CentOS/RHEL 6 system to not used last 3 passwords used
  5. Can’t start X11 applications after “su” or “su -” to another user
  6. Linux OS Service ‘network’
  7. How to create and mount Btrfs file system (explained with examples)
  8. Detect rootkits & malware on Linux Servers using rkhunter
  9. How to change the number of commands stored in Bash History
  10. Understanding DNS zone files

You May Also Like

Primary Sidebar

Recent Posts

  • JavaFX ComboBox: Set a value to the combo box
  • Nginx load balancing
  • nginx 504 gateway time-out
  • Images preview with ngx_http_image_filter_module

© 2022 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright