Lines Matching +full:first +full:- +full:generation
1 .. SPDX-License-Identifier: GPL-2.0
4 Multi-Gen LRU
6 The multi-gen LRU is an alternative LRU implementation that optimizes
14 ----------
20 * Simple self-correcting heuristics
23 implementations. In the multi-gen LRU, each generation represents a
25 (time-based) common frame of reference and therefore help make better
41 choices; thus self-correction is necessary.
43 The benefits of simple self-correcting heuristics are self-evident.
45 attainable. Specifically, pages in the same generation can be
51 -----------
83 ``lruvec``. The youngest generation number is stored in
84 ``lrugen->max_seq`` for both anon and file types as they are aged on
85 an equal footing. The oldest generation numbers are stored in
86 ``lrugen->min_seq[]`` separately for anon and file types as clean file
90 Generation numbers are truncated into ``order_base_2(MAX_NR_GENS+1)``
91 bits in order to fit into the gen counter in ``folio->flags``. Each
92 truncated generation number is an index to ``lrugen->lists[]``. The
96 ``lrugen->lists[]``; otherwise it stores zero.
98 Each generation is divided into multiple tiers. A page accessed ``N``
100 generations, tiers do not have dedicated ``lrugen->lists[]``. In
103 ``folio->flags`` and therefore has a negligible cost. A feedback loop
109 eviction. They form a closed-loop system, i.e., the page reclaim.
112 -----
114 increments ``max_seq`` when ``max_seq-min_seq+1`` approaches
116 generation when it finds them accessed through page tables; the
119 young PTEs. For the former, it iterates ``lruvec_memcg()->mm_list``
128 --------
130 increments ``min_seq`` when ``lrugen->lists[]`` indexed by
132 evict from, it first compares ``min_seq[]`` to select the older type.
133 If both types are equally old, it selects the one whose first tier has
134 a lower refault percentage. The first tier contains single-use
138 moves a page to the next generation, i.e., ``min_seq+1``, if this page
141 this end, the feedback loop uses the first tier as the baseline, for
145 -------
146 The multi-gen LRU can be disassembled into the following parts:
154 The aging and the eviction form a producer-consumer model;