[PATCH v10 07/14] mm: multi-gen LRU: exploit locality in rmap

Aneesh Kumar K.V aneesh.kumar at linux.ibm.com
Tue Apr 26 21:32:56 PDT 2022


Yu Zhao <yuzhao at google.com> writes:

....

 diff --git a/mm/rmap.c b/mm/rmap.c
> index fedb82371efe..7cb7ef29088a 100644
> --- a/mm/rmap.c
> +++ b/mm/rmap.c
> @@ -73,6 +73,7 @@
>  #include <linux/page_idle.h>
>  #include <linux/memremap.h>
>  #include <linux/userfaultfd_k.h>
> +#include <linux/mm_inline.h>
>  
>  #include <asm/tlbflush.h>
>  
> @@ -821,6 +822,12 @@ static bool folio_referenced_one(struct folio *folio,
>  		}
>  
>  		if (pvmw.pte) {
> +			if (lru_gen_enabled() && pte_young(*pvmw.pte) &&
> +			    !(vma->vm_flags & (VM_SEQ_READ | VM_RAND_READ))) {
> +				lru_gen_look_around(&pvmw);
> +				referenced++;
> +			}

Is it required to update referenced here? we do that below after
clearing the young bit. Or is the goal to identify whether we found any
young pte around? 

> +
>  			if (ptep_clear_flush_young_notify(vma, address,
>  						pvmw.pte)) {
>  				/*




More information about the linux-arm-kernel mailing list