Re: [PATCH v5 4/9] mm: Add test_clear_young_fast_only MMU notifier

From: James Houghton
Date: Mon Jul 15 2024 - 19:15:55 EST


On Fri, Jul 12, 2024 at 8:06 AM Sean Christopherson <seanjc@xxxxxxxxxx> wrote:
>
> On Wed, Jul 10, 2024, James Houghton wrote:
> > 1. Drop the WAS_FAST complexity.
> > 2. Add a function like mm_has_fast_aging_notifiers(), use that to
> > determine if we should be doing look-around.
>
> I would prefer a flag over a function. Long-term, if my pseudo-lockless rmap
> idea pans out, KVM can set the flag during VM creation. Until then, KVM can set
> the flag during creation and then toggle it in (un)account_shadowed(). Races
> will be possible, but they should be extremely rare and quite benign, all things
> considered.

So I think you're talking about .has_fast_aging bool on struct
mmu_notifier, and we would do look-around if that is set, right? So
we'd need to have something like mm_has_fast_aging_notifiers() to
check if any of the subscribed mmu notifiers have .has_fast_aging.

We could toggle it in (un)account_shadowed(), but I think I'd need to
demonstrate some performance win to justify it.