On Fri, Aug 2, 2024 at 8:57 AM David Hildenbrand <david@xxxxxxxxxx> wrote: > > On 02.08.24 01:13, James Houghton wrote: > > On Thu, Aug 1, 2024 at 2:36 AM David Hildenbrand <david@xxxxxxxxxx> wrote: > >> > >> On 24.07.24 03:10, James Houghton wrote: > >>> For implementers, the fast_only bool indicates that the age information > >>> needs to be harvested such that we do not slow down other MMU operations, > >>> and ideally that we are not ourselves slowed down by other MMU > >>> operations. Usually this means that the implementation should be > >>> lockless. > >> > >> But what are the semantics if "fast_only" cannot be achieved by the > >> implementer? > >> > >> Can we add some documentation to the new functions that explain what > >> this mysterious "fast_only" is and what the expected semantics are? > >> Please? :) > > > > Thanks for pointing out the missing documentation. How's this? > > > > diff --git a/include/linux/mmu_notifier.h b/include/linux/mmu_notifier.h > > index 45c5995ebd84..c21992036dd3 100644 > > --- a/include/linux/mmu_notifier.h > > +++ b/include/linux/mmu_notifier.h > > @@ -106,6 +106,18 @@ struct mmu_notifier_ops { > > * clear_young is a lightweight version of clear_flush_young. Like the > > * latter, it is supposed to test-and-clear the young/accessed bitflag > > * in the secondary pte, but it may omit flushing the secondary tlb. > > + * > > Probably makes sense to highlight the parameters like @fast_only Will do. > > > + * The fast_only parameter indicates that this call should not block, > > + * and this function should not cause other MMU notifier calls to > > + * block. Usually this means that the implementation should be > > + * lockless. > > + * > > + * When called with fast_only, this notifier will be a no-op unless > > + * has_fast_aging is set on the struct mmu_notifier. > > "... and will return 0 (NOT young)." ? Thanks, I'll add this. > > > + * > > + * When fast_only is true, if the implementer cannot determine that a > > + * range is young without blocking, it should return 0 (i.e., > > + * that the range is NOT young). > > */ > > int (*clear_young)(struct mmu_notifier *subscription, > > struct mm_struct *mm, > > @@ -118,6 +130,8 @@ struct mmu_notifier_ops { > > * the secondary pte. This is used to know if the page is > > * frequently used without actually clearing the flag or tearing > > * down the secondary mapping on the page. > > + * > > + * The fast_only parameter has the same meaning as with clear_young. > > */ > > int (*test_young)(struct mmu_notifier *subscription, > > struct mm_struct *mm, > > > > I've also moved the commit that follows this one (the one that adds > > has_fast_aging) to be before this one so that the comment makes sense. > > > Makes sense, thanks! Thanks David!