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

The Geek Diary

CONCEPTS | BASICS | HOWTO

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • Linux Services
    • VCS
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
    • Data Guard
  • DevOps
    • Docker
    • Shell Scripting
  • Interview Questions
  • 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. MySQL Fails to Start Using systemctl On systemd Linux Distributions
  2. How to Rebuild GRUB on MSDOS Partition Type in CentOS/RHEL/OEL 7
  3. How to Setup a sudo Switch to Another User That Has no Password or ssh Key Set in Linux
  4. Time goes out of sync on a node running CentOS/RHEL 7
  5. CentOS / RHEL 5 : How to disable device mapper multipath (dm-multipath)
  6. CentOS / RHEL 6 : how to start the services interactively during boot (to disable/abort some services)
  7. What are Symbolic Links (Soft Links) and how to create them under Linux
  8. CentOS / RHEL 6 : How to change SNMP log level
  9. How to install and configure “setroubleshootd” on CentOS/RHEL
  10. How to Disable the ‘lvm2-lvmetad.socket/service’ on CentOS/RHEL 7

You May Also Like

Primary Sidebar

Recent Posts

  • How to Disable IPv6 on Ubuntu 18.04 Bionic Beaver Linux
  • How to Capture More Logs in /var/log/dmesg for CentOS/RHEL
  • Unable to Start RDMA Services on CentOS/RHEL 7
  • How to rename a KVM VM with virsh
  • Archives
  • Contact Us
  • Copyright

© 2021 · The Geek Diary