On Tue, May 10, 2022 at 02:16:07PM -0400, Johannes Weiner wrote: > Hi Minchan, > > The patch looks reasonable to me, but one thing stands out: > > On Tue, May 10, 2022 at 10:11:00AM -0700, Minchan Kim wrote: > > @@ -1391,6 +1391,10 @@ static enum page_references folio_check_references(struct folio *folio, > > if (vm_flags & VM_LOCKED) > > return PAGEREF_ACTIVATE; > > > > + /* page_referenced didn't work due to lock contention */ > > + if (referenced_ptes == -1) > > + return PAGEREF_KEEP; > > + > > if (referenced_ptes) { > > /* > > * All mapped folios start out with page table > > This means contended inactive pages get rotated. > > > @@ -2492,7 +2496,7 @@ static void shrink_active_list(unsigned long nr_to_scan, > > } > > > > if (folio_referenced(folio, 0, sc->target_mem_cgroup, > > - &vm_flags)) { > > + &vm_flags) > 0) { > > /* > > * Identify referenced, file-backed active pages and > > * give them one more trip around the active list. So > > This means contended active pages do NOT get rotated. > > It's a bit of an arbitrary choice what to do with reclaim candidates > for which you can get no reference information, but staying consistent > is likely a good idea. My preference would be to just rotate contended > pages throughout rather than risk dropping the workingset on the floor. > > /* Referenced or rmap lock contention: rotate */ > if (folio_referenced() != 0) { > ... > > What do you think? Sure, it's good start before adding more heuristic later. Thanks for the review. I will post v4.