linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] mm: multi-gen LRU: Have secondary MMUs participate in MM_WALK
@ 2024-10-19  1:29 James Houghton
  2024-10-19  1:29 ` [PATCH 1/2] mm: multi-gen LRU: remove MM_LEAF_OLD and MM_NONLEAF_TOTAL stats James Houghton
  2024-10-19  1:29 ` [PATCH 2/2] mm: multi-gen LRU: use {ptep,pmdp}_clear_young_notify() James Houghton
  0 siblings, 2 replies; 5+ messages in thread
From: James Houghton @ 2024-10-19  1:29 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Sean Christopherson, Paolo Bonzini, David Matlack,
	David Rientjes, James Houghton, Oliver Upton, David Stevens,
	Yu Zhao, Wei Xu, Axel Rasmussen, kvm, linux-kernel, linux-mm

Today, the MM_WALK capability causes MGLRU to clear the young bit from
PMDs and PTEs during the page table walk before eviction, but MGLRU does
not call the clear_young() MMU notifier in this case. By not calling
this notifier, the MM walk takes less time/CPU, but it causes pages that
are accessed mostly through KVM / secondary MMUs to appear younger than
they should be.

We do call the clear_young() notifier today, but only when attempting to
evict the page, so we end up clearing young/accessed information less
frequently for secondary MMUs than for mm PTEs, and therefore they
appear younger and are less likely to be evicted. Therefore, memory that
is *not* being accessed mostly by KVM will be evicted *more* frequently,
worsening performance.

ChromeOS observed a tab-open latency regression when enabling MGLRU with
a setup that involved running a VM:

		Tab-open latency histogram (ms)
Version		p50	mean	p95	p99	max
base		1315	1198	2347	3454	10319
mglru		2559	1311	7399	12060	43758
fix		1119	926	2470	4211	6947

This series replaces the final non-selftest patchs from this series[1],
which introduced a similar change (and a new MMU notifier) with KVM
optimizations. I'll send a separate series (to Sean and Paolo) for the
KVM optimizations.

This series also makes proactive reclaim with MGLRU possible for KVM
memory. I have verified that this functions correctly with the selftest
from [1], but given that that test is a KVM selftest, I'll send it with
the rest of the KVM optimizations later. Andrew, let me know if you'd
like to take the test now anyway.

[1]: https://lore.kernel.org/linux-mm/20240926013506.860253-18-jthoughton@google.com/

Yu Zhao (2):
  mm: multi-gen LRU: remove MM_LEAF_OLD and MM_NONLEAF_TOTAL stats
  mm: multi-gen LRU: use {ptep,pmdp}_clear_young_notify()

 include/linux/mmzone.h |   7 ++-
 mm/rmap.c              |   9 ++--
 mm/vmscan.c            | 105 +++++++++++++++++++++--------------------
 3 files changed, 60 insertions(+), 61 deletions(-)


base-commit: b5d43fad926a3f542cd06f3c9d286f6f489f7129
-- 
2.47.0.105.g07ac214952-goog



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-10-24  3:28 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-10-19  1:29 [PATCH 0/2] mm: multi-gen LRU: Have secondary MMUs participate in MM_WALK James Houghton
2024-10-19  1:29 ` [PATCH 1/2] mm: multi-gen LRU: remove MM_LEAF_OLD and MM_NONLEAF_TOTAL stats James Houghton
2024-10-24  3:26   ` Andrew Morton
2024-10-24  3:27     ` Yu Zhao
2024-10-19  1:29 ` [PATCH 2/2] mm: multi-gen LRU: use {ptep,pmdp}_clear_young_notify() James Houghton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox