f80dedb4057871442ba45e24a45329f7cd91207a
[openwrt/staging/robimarko.git] /
1 From 5ddf9d53d375e42af49b744bd7c2f8247c6bce15 Mon Sep 17 00:00:00 2001
2 From: "T.J. Alumbaugh" <talumbau@google.com>
3 Date: Wed, 18 Jan 2023 00:18:22 +0000
4 Subject: [PATCH 13/19] UPSTREAM: mm: multi-gen LRU: section for rmap/PT walk
5 feedback
6
7 Add a section for lru_gen_look_around() in the code and the design doc.
8
9 Link: https://lkml.kernel.org/r/20230118001827.1040870-3-talumbau@google.com
10 Change-Id: I5097af63f61b3b69ec2abee6cdbdc33c296df213
11 Signed-off-by: T.J. Alumbaugh <talumbau@google.com>
12 Cc: Yu Zhao <yuzhao@google.com>
13 Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
14 (cherry picked from commit db19a43d9b3a8876552f00f656008206ef9a5efa)
15 Bug: 274865848
16 Signed-off-by: T.J. Mercier <tjmercier@google.com>
17 ---
18 Documentation/mm/multigen_lru.rst | 14 ++++++++++++++
19 mm/vmscan.c | 4 ++++
20 2 files changed, 18 insertions(+)
21
22 diff --git a/Documentation/mm/multigen_lru.rst b/Documentation/mm/multigen_lru.rst
23 index 6e1483e70fdca..bd988a142bc2f 100644
24 --- a/Documentation/mm/multigen_lru.rst
25 +++ b/Documentation/mm/multigen_lru.rst
26 @@ -156,6 +156,20 @@ This time-based approach has the following advantages:
27 and memory sizes.
28 2. It is more reliable because it is directly wired to the OOM killer.
29
30 +Rmap/PT walk feedback
31 +---------------------
32 +Searching the rmap for PTEs mapping each page on an LRU list (to test
33 +and clear the accessed bit) can be expensive because pages from
34 +different VMAs (PA space) are not cache friendly to the rmap (VA
35 +space). For workloads mostly using mapped pages, searching the rmap
36 +can incur the highest CPU cost in the reclaim path.
37 +
38 +``lru_gen_look_around()`` exploits spatial locality to reduce the
39 +trips into the rmap. It scans the adjacent PTEs of a young PTE and
40 +promotes hot pages. If the scan was done cacheline efficiently, it
41 +adds the PMD entry pointing to the PTE table to the Bloom filter. This
42 +forms a feedback loop between the eviction and the aging.
43 +
44 Summary
45 -------
46 The multi-gen LRU can be disassembled into the following parts:
47 diff --git a/mm/vmscan.c b/mm/vmscan.c
48 index ab0b8d3b9d88f..8fa82630240d6 100644
49 --- a/mm/vmscan.c
50 +++ b/mm/vmscan.c
51 @@ -4553,6 +4553,10 @@ static void lru_gen_age_node(struct pglist_data *pgdat, struct scan_control *sc)
52 }
53 }
54
55 +/******************************************************************************
56 + * rmap/PT walk feedback
57 + ******************************************************************************/
58 +
59 /*
60 * This function exploits spatial locality when shrink_folio_list() walks the
61 * rmap. It scans the adjacent PTEs of a young PTE and promotes hot pages. If
62 --
63 2.40.1
64