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";


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 calculate 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.

¿Fue útil la respuesta? 0 Los Usuarios han Encontrado Esto Útil (0 Votos)