Avoiding Linux Memory Waste: Facebook Develops New THP Shrinkage Mechanism

Meta/Facebook engineers announced their work on THP Shrinker, a way to make Linux 's Transparent Pages (THP) work more efficiently by removing underutilized transparent pages to avoid memory waste.

For some workloads, THP can improve efficiency by reducing the miss status of the TLB cache, but if the page size of 2MB and 4Kb is not used effectively, it will lead to a lot of memory waste.

Facebook engineers found on one of their platforms that even about 2.7GB of memory wasted per machine due to underutilized THP.

The THP shrinking mechanism that Facebook is developing for the Linux kernel is designed to solve this waste, while still enjoying the advantages of THP for CPU efficiency. THP Shrinker will divide the least utilized large memory pages.

THP Shrinker aims to avoid wasting RAM and to make huge memory pages transparent and open to the outside world as much as possible, so that they can be enabled unconditionally, thus replacing the selection based on the madevise system call.

Facebook engineers are working on adding additional tweaks around this THP Shrinker and possibly hooking into CPU/IO/Memory pressure events. Ultimately, the engineers hope that the THP shrinker will simply do away with Linux's madvise THP mode, and switch to THP enabled for all applications.

Guess you like

Origin blog.csdn.net/linux_hua130/article/details/129353846