• 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

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. Linux OS Service ‘sshd’
  2. How to setup passwordless SSH login in Linux
  3. CentOS / RHEL : How to find RPM installation date and time
  4. Beginners Guide to yum Configuration
  5. How To Add/Remove Locale Archive in CentOS/RHEL 5,6
  6. how to add a custom script to the systemd in CentOS/RHEL 7
  7. How to enable text colour in vi similar to vim in CentOS/RHEL
  8. How to Enable FTP in CentOS/RHEL 5 and 6
  9. Choosing SSSD or Winbind & Samba for Active Directory Integration in CentOS/RHEL
  10. Configuring Persistent Storage in CentOS/RHEL 5,6 for Single Path using udev rules

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