• 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

How To Calculate The Memory Reserved By HugePages in CentOS/RHEL

by admin

Question: How to Calculate the percentage of memory reserved by Huge Pages?

1. Inspect the memory parameters:

# cat /proc/meminfo
MemTotal: 98721456 kB
MemFree: 1277612 kB
MemAvailable: 12186676 kB
Buffers: 20496 kB
Cached: 11013124 kB
SwapCached: 4820 kB
Active: 2303780 kB
Inactive: 9716992 kB
Active(anon): 716672 kB
Inactive(anon): 582092 kB
Active(file): 1587108 kB
Inactive(file): 9134900 kB
Unevictable: 0 kB
Mlocked: 0 kB
SwapTotal: 33554428 kB
SwapFree: 32965424 kB
Dirty: 16856 kB
Writeback: 0 kB
AnonPages: 1004112 kB
Mapped: 308188 kB
Shmem: 290944 kB
Slab: 694100 kB
SReclaimable: 602280 kB
SUnreclaim: 91820 kB
KernelStack: 13792 kB
PageTables: 75736 kB
NFS_Unstable: 0 kB
Bounce: 0 kB
WritebackTmp: 0 kB
CommitLimit: 40956756 kB
Committed_AS: 3011596 kB
VmallocTotal: 34359738367 kB
VmallocUsed: 256480 kB
VmallocChunk: 34359477292 kB
HardwareCorrupted: 0 kB
AnonHugePages: 0 kB
CmaTotal: 0 kB
CmaFree: 0 kB
HugePages_Total: 40975
HugePages_Free: 35867
HugePages_Rsvd: 13
HugePages_Surp: 0
Hugepagesize: 2048 kB
DirectMap4k: 163840 kB
DirectMap2M: 14516224 kB
DirectMap1G: 87031808 kB

2. Calculate the percentage of memory used by HugePages:

memory% = (HugePages_Total * Hugepagesize) / MemTotal * 100.0

3. Use the values appropriate for your system, taken from the /proc/meminfo report. For example, from the example above:

memory% = (HugePages_Total * Hugepagesize) / MemTotal * 100.0 
memory% = (40975 * 2048) / 98721456 * 100.0
memory% = 83916800 / 98721456 * 100.0
memory% = 85.04

The HugePages configuration reserves about 85% of the physical memory on the server.

Note that all values in /proc/meminfo use the same units, so no conversion is necessary.

Filed Under: CentOS/RHEL, CentOS/RHEL 6, CentOS/RHEL 7, CentOS/RHEL 8, Linux

Some more articles you might also be interested in …

  1. CentOS / RHEL 7 : How to Install GUI
  2. Configure Network Bonding in Ubuntu Server
  3. How to format code within web pages
  4. Introduction to sed (Stream Editor) : Useful sed Command Examples
  5. Linux OS Service ‘named’
  6. Linux interview questions – Special permissions (SUID, SGID and sticky bit)
  7. RHEL 7 – RHCSA Notes – input / output redirection
  8. “su: Authentication failure” – in Docker
  9. RPM command examples to query, install, remove and upgrade packages
  10. How to create an XFS Filesystem

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