Re: + mm-reclaim-madv_free-pages.patch added to -mm tree

From: Minchan Kim
Date: Tue Mar 07 2017 - 01:05:58 EST


On Mon, Mar 06, 2017 at 10:49:06AM -0500, Johannes Weiner wrote:

< snip >

> > @@ -1413,20 +1413,24 @@ static int try_to_unmap_one(struct page *page, struct vm_area_struct *vma,
> > * Store the swap location in the pte.
> > * See handle_pte_fault() ...
> > */
> > - VM_BUG_ON_PAGE(!PageSwapCache(page) && PageSwapBacked(page),
> > - page);
> > + if (VM_WARN_ON_ONCE(PageSwapBacked(page) &&
> > + !PageSwapCache(page))) {
> > + ret = SWAP_FAIL;
>
> But you're not adding the !swapbacked && swapcache case?
>
> > + page_vma_mapped_walk_done(&pvmw);
> > + break;
> > + }
>
> [...]
>
> > - /*
> > - * swapin page could be clean, it has data stored in
> > - * swap. We can't silently discard it without setting
> > - * swap entry in the page table.
> > - */
> > - if (!PageDirty(page) && !PageSwapCache(page)) {
> > - /* It's a freeable page by MADV_FREE */
> > - dec_mm_counter(mm, MM_ANONPAGES);
> > - goto discard;
> > - } else if (!PageSwapBacked(page)) {
> > - /* dirty MADV_FREE page */
> > + /* MADV_FREE page check */
> > + if (!PageSwapBacked(page)) {
> > + if (!PageDirty(page)) {
> > + dec_mm_counter(mm, MM_ANONPAGES);
> > + goto discard;
> > + }
>
> Andrew already has this, you might want to send the warning changes as
> a separate patch on top of this one.

Here it goes.