Commit 055b35ec authored by Yu Zhao's avatar Yu Zhao Committed by Commit Bot
Browse files

BACKPORT: FROMLIST: mm: multigenerational lru: user interface



Add /sys/kernel/mm/lru_gen/enabled to enable and disable the
multigenerational lru at runtime.

Add /sys/kernel/mm/lru_gen/min_ttl_ms to protect the working set of a
given number of milliseconds. The OOM killer is invoked if this
working set cannot be kept in memory.

Add /sys/kernel/debug/lru_gen to monitor the multigenerational lru and
invoke the aging and the eviction. This file has the following output:
  memcg  memcg_id  memcg_path
    node  node_id
      min_gen  birth_time  anon_size  file_size
      ...
      max_gen  birth_time  anon_size  file_size

min_gen is the oldest generation number and max_gen is the youngest
generation number. birth_time is in milliseconds. anon_size and
file_size are in pages.

This file takes the following input:
  + memcg_id node_id max_gen [swappiness]
  - memcg_id node_id min_gen [swappiness] [nr_to_reclaim]

The first command line invokes the aging, which scans PTEs for
accessed pages and then creates the next generation max_gen+1. A swap
file and a non-zero swappiness, which overrides vm.swappiness, are
required to scan PTEs mapping anon pages. The second command line
invokes the eviction, which evicts generations less than or equal to
min_gen. min_gen should be less than max_gen-1 as max_gen and
max_gen-1 are not fully aged and therefore cannot be evicted.
nr_to_reclaim can be used to limit the number of pages to evict.
Multiple command lines are supported, as is concatenation with
delimiters "," and ";".

Signed-off-by: default avatarYu Zhao <yuzhao@google.com>
Tested-by: default avatarKonstantin Kharlamov <Hi-Angel@yandex.ru>
(am from https://lore.kernel.org/patchwork/patch/1478362/)

BUG=b:123039911
TEST=Built

Change-Id: I4448e60029badbe347aa3b624f429b280cc3a3d3
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/kernel/+/3132026


Reviewed-by: default avatarYu Zhao <yuzhao@chromium.org>
Reviewed-by: default avatarSergey Senozhatsky <senozhatsky@chromium.org>
Tested-by: default avatarYu Zhao <yuzhao@chromium.org>
Commit-Queue: Yu Zhao <yuzhao@chromium.org>
parent 1fe5e6a8
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment