• 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

RHEL/CentOS 6,7 : How to caculate the size of hugepage used by a specific process/application

by admin

You have a system configured with hugepages and you want to find per-process hugepages utilization.

# grep -i huge /proc/meminfo
HugePages_Total:  2176
HugePages_Free:   2065
HugePages_Rsvd:   2065
Hugepagesize:     2048 kB

Method 1

The following command can be used to see which processes are using THP:

for i in /proc/*/smaps; do
    if [[ $(grep '^AnonHugePages' $i | grep -v '0 kB$') ]]; then
        echo -ne "$i procees maybe running THP mode if you are using THP mode in kernel:\n";
    fi;
done

Evaluating AnonHugePages here will show if Transparent Huge Pages (THP) are used.

Method 2 – hugepages used by a process

The following command can be used to caculate the size of hugepage used by a specified process, assumption that HugePage size is 2048 kB, the output unit is MiB:

# grep -B 11 'KernelPageSize:     2048 kB' /proc/[PID]/smaps | grep "^Size:" | awk 'BEGIN{sum=0}{sum+=$2}END{print sum/1024}'
Note: avoid double counting of the same address in /proc/[PID]/smaps.
CentOS / RHEL 6,7 : How to configure hugepages

Filed Under: CentOS/RHEL 7, Linux

Some more articles you might also be interested in …

  1. Troubleshooting slow network communication or Connection Timeouts in Linux
  2. iostat: command not found
  3. How To Configure NIS (Network Information System) Master and Slave Servers in CentOS/RHEL
  4. pvdisplay Command Examples in Linux
  5. How to list all modules and check if they are enabled or disabled in CentOS/RHEL 8
  6. libreoffice Command Examples in Linux
  7. gs: command not found
  8. How to encrypt traffic between CUPS servers
  9. How to Create An LVM Snapshot Of The Root Filesystem And Restore To An Earlier State
  10. CentOS / RHEL 7 : How to create an Network Bonding (NIC teaming) using nmcli

You May Also Like

Primary Sidebar

Recent Posts

  • qm Command Examples in Linux
  • qm wait Command Examples in Linux
  • qm start Command Examples in Linux
  • qm snapshot Command Examples in Linux

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright