Linux (non-transparent) per-process hugepage accounting

Posted by Dan Pritts on Server Fault See other posts from Server Fault or by Dan Pritts
Published on 2013-07-29T17:21:46Z Indexed on 2013/08/02 15:42 UTC
Read the original article Hit count: 261

Filed under:
|
|

I've recently converted some java apps to run with linux manually-configured hugepages. I've got about 10 tomcats running on a system and I am interested in knowing how much memory each one is using.

I can get summary information out of /proc/meminfo as described in Linux Huge Pages Usage Accounting.

But I can't find any tools that tell me about the actual per-process hugepage usage.

I poked around in /proc/pid/numa_stat and found some interesting information that led me to this grossity:

function pshugepage () {
    HUGEPAGECOUNT=0
    for num in `grep 'anon_hugepage.*dirty=' /proc/$@/numa_maps | awk '{print $6}' | sed 's/dirty=//'` ; do
        HUGEPAGECOUNT=$((HUGEPAGECOUNT+num))
    done
    echo process $@ using $HUGEPAGECOUNT huge pages
}

The numbers it gives me are plausible, but i'm far from confident this method is correct.

Environment is a quad-CPU dell, 64GB ram, RHEL6.3, oracle jdk 1.7.x (current as of 20130728)

© Server Fault or respective owner

Related posts about linux-kernel

Related posts about java-opts