feat(kernel): enable Multi-Gen LRU (MGLRU) for improved reclamation #2225
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This commit enables Multi-Gen LRU (CONFIG_LRU_GEN) across supported target kernels. MGLRU replaces the kernel's traditional page reclamation logic with a more efficient multi-generational approach.
This is highly beneficial for memory-constrained ARM SoCs, as it provides better heuristics for identifying "hot" vs "cold" pages, significantly reducing unnecessary I/O and micro-stutters under memory pressure.
Technical Implementation:
Enables CONFIG_LRU_GEN and CONFIG_LRU_GEN_ENABLED.
Targeted at devices running Kernel 6.1 or newer.
Specifically excluded is SDM845 kernels (5.18 kernel).
Initialization and First-Boot Behavior:
Note: Users may observe transient "task wait" messages or increased CPU overhead during the initial boot of a fresh installation. This is a byproduct of MGLRU's generation-tracking heuristics during high-churn operations (such as filesystem expansion and initial cache generation). The scheduler overhead for generation updates stabilizes once the primary working set is established and the initial I/O burst subsides.