On 12/9/20 2:24 AM, Yu Zhao wrote: > We are capable of SetPageWorkingset based on refault distances after > commit aae466b0052e ("mm/swap: implement workingset detection for anonymous LRU") > This is done by workingset_refault(), which is right above the > unconditional SetPageWorkingset deleted by this patch. > > The unconditional SetPageWorkingset miscategorizes pages that are > read ahead or never belonged to the working set (e.g., tmpfs pages > accessed by fd). When those pages are swapped in (after they were > swapped out) for the first time, they skew PSI (when using > async swap). When this happens again, depending on their refault > distances, they might skew workingset_restore_anon counter in > addition to PSI because their shadows say they were part of the > working set. > > Signed-off-by: Yu Zhao <yuzhao@xxxxxxxxxx> Acked-by: Vlastimil Babka <vbabka@xxxxxxx> Makes sense, especially now that we have anonymous LRU support. The flag setting in this context seems to go back all the way to 1899ad18c607 ("mm: workingset: tell cache transitions from workingset thrashing") where I'm not sure why it was even used on the anonymous page, when workingset was only implemented for the page cache. Maybe Johannes remembers? > --- > mm/swap_state.c | 1 - > 1 file changed, 1 deletion(-) > > diff --git a/mm/swap_state.c b/mm/swap_state.c > index 1a01235156d1..6ecc84448d75 100644 > --- a/mm/swap_state.c > +++ b/mm/swap_state.c > @@ -536,7 +536,6 @@ struct page *__read_swap_cache_async(swp_entry_t entry, gfp_t gfp_mask, > workingset_refault(page, shadow); > > /* Caller will initiate read into locked page */ > - SetPageWorkingset(page); > lru_cache_add(page); > *new_page_allocated = true; > return page; >