diff options
| author | Yuanchu Xie <yuanchu@google.com> | 2024-08-13 09:37:59 -0700 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2024-11-08 16:31:01 +0100 |
| commit | 87543f38c0a93bb8d9e86f4a9d84cde08f6b48c9 (patch) | |
| tree | c14d33d1d8511e9874d01dda422afdbc59846f0f | |
| parent | 7f471dbbb229f17102ed5cca9fd455ba9818beec (diff) | |
| download | linux-87543f38c0a93bb8d9e86f4a9d84cde08f6b48c9.tar.gz linux-87543f38c0a93bb8d9e86f4a9d84cde08f6b48c9.tar.bz2 linux-87543f38c0a93bb8d9e86f4a9d84cde08f6b48c9.zip | |
mm: multi-gen LRU: ignore non-leaf pmd_young for force_scan=true
[ Upstream commit bceeeaed4817ba7ad9013b4116c97220a60fcf7c ]
When non-leaf pmd accessed bits are available, MGLRU page table walks can
clear the non-leaf pmd accessed bit and ignore the accessed bit on the pte
if it's on a different node, skipping a generation update as well. If
another scan occurs on the same node as said skipped pte.
The non-leaf pmd accessed bit might remain cleared and the pte accessed
bits won't be checked. While this is sufficient for reclaim-driven aging,
where the goal is to select a reasonably cold page, the access can be
missed when aging proactively for workingset estimation of a node/memcg.
In more detail, get_pfn_folio returns NULL if the folio's nid != node
under scanning, so the page table walk skips processing of said pte. Now
the pmd_young flag on this pmd is cleared, and if none of the pte's are
accessed before another scan occurs on the folio's node, the pmd_young
check fails and the pte accessed bit is skipped.
Since force_scan disables various other optimizations, we check force_scan
to ignore the non-leaf pmd accessed bit.
Link: https://lkml.kernel.org/r/20240813163759.742675-1-yuanchu@google.com
Signed-off-by: Yuanchu Xie <yuanchu@google.com>
Acked-by: Yu Zhao <yuzhao@google.com>
Cc: "Huang, Ying" <ying.huang@intel.com>
Cc: Lance Yang <ioworker0@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Stable-dep-of: ddd6d8e975b1 ("mm: multi-gen LRU: remove MM_LEAF_OLD and MM_NONLEAF_TOTAL stats")
Signed-off-by: Sasha Levin <sashal@kernel.org>
| -rw-r--r-- | mm/vmscan.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/mm/vmscan.c b/mm/vmscan.c index 128f307da6ee..b1f88638c5ab 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -3456,7 +3456,7 @@ static void walk_pmd_range_locked(pud_t *pud, unsigned long addr, struct vm_area goto next; if (!pmd_trans_huge(pmd[i])) { - if (should_clear_pmd_young()) + if (!walk->force_scan && should_clear_pmd_young()) pmdp_test_and_clear_young(vma, addr, pmd + i); goto next; } @@ -3543,7 +3543,7 @@ restart: walk->mm_stats[MM_NONLEAF_TOTAL]++; - if (should_clear_pmd_young()) { + if (!walk->force_scan && should_clear_pmd_young()) { if (!pmd_young(val)) continue; |
