Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have configured Huge Pages for use with Java and it appears to be working well although I have a question about the accounting in /proc/meminfo. To illustrate

# grep HugePages /proc/meminfo 
AnonHugePages:    274432 kB
HugePages_Total:    1008
HugePages_Free:      596
HugePages_Rsvd:      594
HugePages_Surp:        0

My question concerns the "Free" and "Rsvd" numbers - why do they not add up to "Total" of 1008? They actually add up to 1190. What am I not understanding here?

share|improve this question
add comment

1 Answer

up vote 3 down vote accepted

This is because HugePages_rsvd is essentially read from HugePages_Free. Meaning, out of 596 huge pages which are free, 594 are already reserved by some application for use. That is kernel has committed that those 594 huge pages are available for the application.

If there is a request for 3 huge pages now, then it will fail as only 2 are available to be reserved. Think of it as a malloc() call, when you reserve memory virtual pages to account for the VSZ for the process but when the process actually uses them, it becomes the RSZ (running set) of the process.

As huge pages are always resident on main memory, when an app requests them kernel decrements it from free pool and increase the Rsvd counter.

This is from the kernel source.

where:
38HugePages_Total is the size of the pool of huge pages.
39HugePages_Free  is the number of huge pages in the pool that are not yet
40                allocated.
41HugePages_Rsvd  is short for "reserved," and is the number of huge pages for
42                which a commitment to allocate from the pool has been made,
43                but no allocation has yet been made.  Reserved huge pages
44                guarantee that an application will be able to allocate a
45                huge page from the pool of huge pages at fault time.
46HugePages_Surp  is short for "surplus," and is the number of huge pages in
47                the pool above the value in /proc/sys/vm/nr_hugepages. The
48                maximum number of surplus huge pages is controlled by
49                /proc/sys/vm/nr_overcommit_hugepages.
50
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.