Re: [PATCH v5 02/10] mm/vmscan: protect the workingset on anonymous LRU

From: Joonsoo Kim
Date: Mon Apr 06 2020 - 20:40:58 EST


2020ë 4ì 6ì (ì) ìí 6:18, Hillf Danton <hdanton@xxxxxxxx>ëì ìì:
>
>
> On Fri, 3 Apr 2020 14:40:40 +0900 Joonsoo Kim wrote:
> >
> > @@ -3093,11 +3093,10 @@ vm_fault_t do_swap_page(struct vm_fault *vmf)
> > if (unlikely(page != swapcache && swapcache)) {
> > page_add_new_anon_rmap(page, vma, vmf->address, false);
> > mem_cgroup_commit_charge(page, memcg, false, false);
> > - lru_cache_add_active_or_unevictable(page, vma);
> > + lru_cache_add_inactive_or_unevictable(page, vma);
> > } else {
> > do_page_add_anon_rmap(page, vma, vmf->address, exclusive);
> > mem_cgroup_commit_charge(page, memcg, true, false);
> > - activate_page(page);
> > }
> >
> > swap_free(entry);
> ...
> > @@ -996,8 +996,6 @@ static enum page_references page_check_references(struct page *page,
> > return PAGEREF_RECLAIM;
> >
> > if (referenced_ptes) {
> > - if (PageSwapBacked(page))
> > - return PAGEREF_ACTIVATE;
> > /*
> > * All mapped pages start out with page table
> > * references from the instantiating fault, so we need
> > @@ -1020,7 +1018,7 @@ static enum page_references page_check_references(struct page *page,
> > /*
> > * Activate file-backed executable pages after first usage.
> > */
> > - if (vm_flags & VM_EXEC)
> > + if ((vm_flags & VM_EXEC) && !PageSwapBacked(page))
> > return PAGEREF_ACTIVATE;
> >
> > return PAGEREF_KEEP;
> > --
> > 2.7.4
>
> Both changes other than
> s/lru_cache_add_active_or_unevictable/lru_cache_add_inactive_or_unevictable/
> are likely worth their own seperate commits with a concise log.

IMO, all of the changes in this patch provides just one logical change
for LRU management
on anonymous page so it's better to be together.

Thanks.