Re: [PATCHv4 00/25] THP-enabled tmpfs/shmem

From: Hugh Dickins
Date: Mon Mar 28 2016 - 14:42:31 EST


On Mon, 28 Mar 2016, Kirill A. Shutemov wrote:
>
> I think I found it. I have refcounting screwed up in faultaround.
>
> This should fix the problem:

Yes, this fixes it for me - thanks.

Hugh

>
> diff --git a/mm/filemap.c b/mm/filemap.c
> index 94c097ec08e7..1325bb4568d1 100644
> --- a/mm/filemap.c
> +++ b/mm/filemap.c
> @@ -2292,19 +2292,18 @@ repeat:
> if (fe->pte)
> fe->pte += iter.index - last_pgoff;
> last_pgoff = iter.index;
> - alloc_set_pte(fe, NULL, page);
> + if (alloc_set_pte(fe, NULL, page))
> + goto unlock;
> unlock_page(page);
> - /* Huge page is mapped? No need to proceed. */
> - if (pmd_trans_huge(*fe->pmd))
> - break;
> - /* Failed to setup page table? */
> - VM_BUG_ON(!fe->pte);
> goto next;
> unlock:
> unlock_page(page);
> skip:
> page_cache_release(page);
> next:
> + /* Huge page is mapped? No need to proceed. */
> + if (pmd_trans_huge(*fe->pmd))
> + break;
> if (iter.index == end_pgoff)
> break;
> }
> --
> Kirill A. Shutemov