On Wed, May 29, 2024 at 12:05 PM James Houghton jthoughton@google.com wrote:
Secondary MMUs are currently consulted for access/age information at eviction time, but before then, we don't get accurate age information. That is, pages that are mostly accessed through a secondary MMU (like guest memory, used by KVM) will always just proceed down to the oldest generation, and then at eviction time, if KVM reports the page to be young, the page will be activated/promoted back to the youngest generation.
Correct, and as I explained offline, this is the only reasonable behavior if we can't locklessly walk secondary MMUs.
Just for the record, the (crude) analogy I used was: Imagine a large room with many bills ($1, $5, $10, ...) on the floor, but you are only allowed to pick up 10 of them (and put them in your pocket). A smart move would be to survey the room *first and then* pick up the largest ones. But if you are carrying a 500 lbs backpack, you would just want to pick up whichever that's in front of you rather than walk the entire room.
MGLRU should only scan (or lookaround) secondary MMUs if it can be done lockless. Otherwise, it should just fall back to the existing approach, which existed in previous versions but is removed in this version.
Do not do look around if there is a secondary MMU we have to interact with.
The added feature bit (0x8), if disabled, will make MGLRU behave as if there are no secondary MMUs subscribed to MMU notifiers except at eviction time.
Suggested-by: Yu Zhao yuzhao@google.com Signed-off-by: James Houghton jthoughton@google.com
This is not what I suggested, and it would have been done in the first place if it hadn't regressed the non-lockless case.
NAK.