我已经configuration了巨大的页面用于Java和它似乎运作良好,虽然我有一个关于在/ proc / meminfo会计问题。 为了显示
# grep HugePages /proc/meminfo AnonHugePages: 274432 kB HugePages_Total: 1008 HugePages_Free: 596 HugePages_Rsvd: 594 HugePages_Surp: 0
我的问题涉及“免费”和“Rsvd”数字 – 为什么他们不加起来1008的“总数”? 他们实际上加起来是1190.我在这里不了解什么?
这是因为HugePages_rsvd本质上是从HugePages_Free中读取的。 在596个免费的大页面中,有594个已经被某些应用程序保留使用。 这是内核承诺,这594个巨大的页面可用于应用程序。
如果现在有3个大页面的请求,那么它将会失败,因为只有2个可用于保留。 将其视为一个malloc()调用,当您保留内存虚拟页面来说明进程的VSZ,但是当进程实际使用它们时,它将成为进程的RSZ(运行集)。
由于巨大的页面总是驻留在主内存中,所以当应用程序请求内核从空闲池中递减时,并增加Rsvd计数器。
这是来自内核源码。 https://www.kernel.org/doc/Documentation/vm/hugetlbpage.txt
where: HugePages_Total is the size of the pool of huge pages. HugePages_Free is the number of huge pages in the pool that are not yet allocated. HugePages_Rsvd is short for "reserved," and is the number of huge pages for which a commitment to allocate from the pool has been made, but no allocation has yet been made. Reserved huge pages guarantee that an application will be able to allocate a huge page from the pool of huge pages at fault time. HugePages_Surp is short for "surplus," and is the number of huge pages in the pool above the value in /proc/sys/vm/nr_hugepages. The maximum number of surplus huge pages is controlled by /proc/sys/vm/nr_overcommit_hugepages.