Transparent Hugepages are a feature that allows the kernel to attempt to automatically back any anonymous maps with "huge" 2MiB page tables, instead of the normal 4k entries. It can produce small net performance gains in certain benchmarks, but also has numerous downsides, in the form of apparent memory leaks and 30% slowdowns or worse for some applications. Many popular pieces of software now refuse to run with hugepages enabled because of known performance issues.
Setting `enabled=madvise` enables applications that know they benefit from transparent huge pages to opt-in to this feature, while eliminating all the problematic behavior for other applications. Note also that transparent hugepage settings don't affect the use of explicit hugepages via hugetlbfs or mmap(…, MAP_HUGETLB, …)
Ubuntu kernels should default transparent_ hugepages to enabled=madvise, not enabled=always
(this corresponds to TRANSPARENT_ HUGEPAGE_ MADVISE= y in .config).
I've blogged about this at some length here: https:/ /blog.nelhage. com/post/ transparent- hugepages/ but here is a summary:
Transparent Hugepages are a feature that allows the kernel to attempt to automatically back any anonymous maps with "huge" 2MiB page tables, instead of the normal 4k entries. It can produce small net performance gains in certain benchmarks, but also has numerous downsides, in the form of apparent memory leaks and 30% slowdowns or worse for some applications. Many popular pieces of software now refuse to run with hugepages enabled because of known performance issues.
Examples of problem reports: /docs.mongodb. com/manual/ tutorial/ transparent- huge-pages/ /blogs. oracle. com/linux/ entry/performan ce_issues_ with_transparen t_huge /docs.splunk. com/Documentati on/Splunk/ 6.5.2/ReleaseNo tes/SplunkandTH P /github. com/golang/ go/issues/ 8832 /blog.digitaloc ean.com/ transparent- huge-pages- and-alternative -memory- allocators/ /github. com/nodejs/ node/issues/ 11077
MongoDB: https:/
Oracle: https:/
Splunk: https:/
Go runtime: https:/
jemalloc: https:/
node.js: https:/
Setting `enabled=madvise` enables applications that know they benefit from transparent huge pages to opt-in to this feature, while eliminating all the problematic behavior for other applications. Note also that transparent hugepage settings don't affect the use of explicit hugepages via hugetlbfs or mmap(…, MAP_HUGETLB, …)