8

The Transparent Huge Pages(THP) support in recent Linux kernels allows automatic promotion/demotion between different page sizes (e.g., 4KB and 2MB in x86-64).

But I am not sure if THP can also promote/demote page sizes between 4KB and 1GB pages or between 2MB and 1GB pages.

Can somebody comment on this?

Peter Cordes
  • 328,167
  • 45
  • 605
  • 847
Arka
  • 955
  • 2
  • 12
  • 21

1 Answers1

12

According to this article

http://lwn.net/Articles/423584/

The current patch only works with anonymous pages; the work to integrate huge pages with the page cache has not yet been done. It also only handles one huge page size (2MB). Even so, some useful performance improvements can be seen. Mel Gorman ran some benchmarks showing improvements of up to 10% or so in some situations. In general, the results were not as good as could be obtained with hugetlbfs, but THP is much more likely to actually be used.

So, it seems that THP support implemented for 4k -> 2M/4M merging/splitting.

Also, in kernel sources I've seen that there is a split_huge_page_pmd function and as PMD undergoes to splitting and PMD manages page entries on top of PTE's that has a fixed 4k size I supposed that PMD size (2M/4M) is the maximum transparent huge page size.

Ilya Matveychikov
  • 3,936
  • 2
  • 27
  • 42
  • Thanks. This is very helpful. As follow up question: Do you know if this is a fundamental constraint or a temporary one? – Arka Oct 18 '12 at 20:47
  • I don't know the details on x86_64 huge page support, but I do know that other platforms have different sizes available. For instance, IBM power does 64KB and 16GB, and I think some others. – Dan Pritts Jul 29 '13 at 17:57
  • So, even if hardware supports 1GB pages, THP only works with 2MB/4MB? – horro Jun 27 '18 at 07:35
  • No, THP works with the page sizes supported by the hardware. – danblack Feb 25 '19 at 04:09