Re: [PATCH v4 4/4] mm: introduce MADV_PAGEOUT

From: Michal Hocko
Date: Fri Jul 12 2019 - 11:01:32 EST


On Fri 12-07-19 09:58:09, Johannes Weiner wrote:
[...]
> > @@ -423,6 +445,12 @@ static int madvise_cold_pte_range(pmd_t *pmd, unsigned long addr,
> >
> > VM_BUG_ON_PAGE(PageTransCompound(page), page);
> >
> > + if (pageout) {
> > + if (isolate_lru_page(page))
> > + continue;
> > + list_add(&page->lru, &page_list);
> > + }
> > +
> > if (pte_young(ptent)) {
> > ptent = ptep_get_and_clear_full(mm, addr, pte,
> > tlb->fullmm);
>
> One thought on the ordering here.
>
> When LRU isolation fails, it would still make sense to clear the young
> bit: we cannot reclaim the page as we wanted to, but the user still
> provided a clear hint that the page is cold and she won't be touching
> it for a while. MADV_PAGEOUT is basically MADV_COLD + try_to_reclaim.
> So IMO isolation should go to the end next to deactivate_page().

Make sense to me

--
Michal Hocko
SUSE Labs