Linux 거대한 페이지 사용량 계산

Linux 거대한 페이지 사용량 계산

Java와 함께 사용하도록 Huge Pages를 구성했으며 /proc/meminfo의 계정에 대한 질문이 있지만 잘 작동하는 것 같습니다. 설명하기

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

내 질문은 "Free" 및 "Rsvd" 숫자에 관한 것입니다. 왜 이 숫자를 합산하면 1008의 "Total"이 되지 않습니까? 실제로 합하면 1190이 됩니다. 여기서 내가 이해하지 못하는 것은 무엇입니까?

답변1

이는 HugePages_rsvd가 기본적으로 HugePages_Free에서 읽혀지기 때문입니다. 즉, 무료로 제공되는 596개의 거대한 페이지 중 594개는 이미 일부 애플리케이션에서 사용하도록 예약되어 있습니다. 즉, 커널은 해당 594개의 거대한 페이지를 애플리케이션에 사용할 수 있도록 커밋했습니다.

지금 3개의 거대한 페이지에 대한 요청이 있는 경우 2개만 예약할 수 있으므로 실패합니다. 프로세스의 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.

관련 정보