DAMON-Based Memory Reclamation Merged For Linux 5.16
Merged as part of Andrew Morton's patch series for Linux 5.16 is DAMON-based memory reclamation that has been under review on the kernel mailing list the past few months.
This proactive reclamation of memory pages can help under light memory pressure and makes use of Amazon's DAMON framework for determining the cold pages on the system to reclaim.
The developers previously working on the patches summed up the benefits as, "DAMON_RECLAIM on v5.13 Linux kernel with ZRAM swap device and 50ms/s time quota achieves 40.34% memory saving with only 3.38% runtime overhead. For this, DAMON_RECLAIM consumes only 5.16% of single CPU time. Among the CPU consumption, only up to about 1.448% of single CPU time is expected to be used for the access pattern monitoring."
This DAMON-based reclamation supports a configurable "speed limit" to configure how many resources to spend determining what pages can be paged out. Enabling this feature needs the new CONFIG_DAMON_RECLAIM build option enabled. Kernel parameters can be passed to damon_reclaim or there is also /sys/modules/damin_reclaim as a sysfs interface. Among the options are adjusting the minimum age as a time threshold for identifying cold memory regions, limiting the time of reclamation, the size of the memory for the reclamation, the minimum and maximum time before checking watermarks, the sampling interval, and more.
See the new documentation for learning more about this DAMON reclamation support now found in the Linux 5.16 kernel.