我已将 Huge Pages 配置为与 Java 一起使用,尽管我对 /proc/meminfo 中的记帐有疑问,但它似乎运行良好。为了显示
# grep HugePages /proc/meminfo
AnonHugePages: 274432 kB
HugePages_Total: 1008
HugePages_Free: 596
HugePages_Rsvd: 594
HugePages_Surp: 0
Run Code Online (Sandbox Code Playgroud)
我的问题涉及“免费”和“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.
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
6328 次 |
最近记录: |