Show Your Support: Have you heard of Phoronix Premium? It's what complements advertisements on this site for our premium ad-free service. For less than $4 USD per month, you can help support our site while the funds generated allow us to keep doing Linux hardware reviews, performance benchmarking, maintain our community forums, and much more.
Linux Developers Discuss Improvements To Memory Tiering
The past several kernel releases has offered the basic promoting/demoting of active/inactive memory pages to the respective tiers of memory. Google's Wei Xu summed up though some of the existing shortcomings to the interface and possible improvements to make with this code only becoming more critical moving forward especially with Compute Express Link (CXL) and other technologies coming to market.
Wei Xu summed up the current situation as:
* The current tiering initialization code always initializes each memory-only NUMA node into a lower tier. But a memory-only NUMA node may have a high performance memory device (e.g. a DRAM device attached via CXL.mem or a DRAM-backed memory-only node on a virtual machine) and should be put into the top tier.
* The current tiering hierarchy always puts CPU nodes into the top tier. But on a system with HBM (e.g. GPU memory) devices, these memory-only HBM NUMA nodes should be in the top tier, and DRAM nodes with CPUs are better to be placed into the next lower tier.
* Also because the current tiering hierarchy always puts CPU nodes into the top tier, when a CPU is hot-added (or hot-removed) and triggers a memory node from CPU-less into a CPU node (or vice versa), the memory tiering hierarchy gets changed, even though no memory node is added or removed. This can make the tiering hierarchy much less stable.
* A higher tier node can only be demoted to selected nodes on the next lower tier, not any other node from the next lower tier. This strict, hard-coded demotion order does not work in all use cases (e.g. some use cases may want to allow cross-socket demotion to another node in the same demotion tier as a fallback when the preferred demotion node is out of space), and has resulted in the feature request for an interface to override the system-wide, per-node demotion order from the userspace.
* There are no interfaces for the userspace to learn about the memory tiering hierarchy in order to optimize its memory allocations.
Other upstream kernel developers have been in agreement that there is room for improvement, including Intel engineers acknowledging this who worked on much of the original tiered memory handling code for the kernel.
Those interested in some of the suggested improvements and discussion around Linux's tiered memory handling can see this kernel mailing list thread for all the activity.