BACKPORT: FROMLIST: mm: multigenerational lru: eviction
The eviction consumes old generations. Given an lruvec, the eviction scans pages on lrugen->lists indexed by anon and file min_seq[2] (modulo MAX_NR_GENS). It first tries to select a type based on the values of min_seq[2]. If they are equal, it selects the type that has a lower refault rate. The eviction sorts a page according to its updated generation number if the aging has found this page accessed. It also moves a page to the next generation if this page is from an upper tier that has a higher refault rate than the base tier. The eviction increments min_seq[2] of a selected type when it finds lrugen->lists indexed by min_seq[2] of this selected type are empty. With the aging and the eviction in place, implementing page reclaim becomes quite straightforward: 1) To reduce the latency, direct reclaim skips the aging unless both min_seq[2] are equal to max_seq-1. Then it invokes the eviction. 2) To avoid the aging in the direct reclaim path, kswapd invokes the aging if either of min_seq[2] is equal to max_seq-1. Then it invokes the eviction. Signed-off-by:Yu Zhao <yuzhao@google.com> Tested-by:
Konstantin Kharlamov <Hi-Angel@yandex.ru> (am from https://lore.kernel.org/patchwork/patch/1478361/) BUG=b:123039911 TEST=Built Change-Id: I64c06d8f2cdb83ac7d56c7e1d07f043483956cac Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/kernel/+/3132025 Tested-by:
Yu Zhao <yuzhao@chromium.org> Commit-Queue: Yu Zhao <yuzhao@chromium.org> Reviewed-by:
Sergey Senozhatsky <senozhatsky@chromium.org> Reviewed-by:
Alexandre Marciano Gimenez <raging@google.com>
Loading
Please sign in to comment