Re: [PATCH 1/2] mm: Allow architectures to request 'old' entries when prefaulting

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, Dec 19, 2020 at 4:41 AM Kirill A. Shutemov <kirill@xxxxxxxxxxxxx> wrote:
>
> @@ -2884,19 +2966,18 @@ void filemap_map_pages(struct vm_fault *vmf,
>                 if (vmf->pte)
>                         vmf->pte += xas.xa_index - last_pgoff;
>                 last_pgoff = xas.xa_index;
> -               if (alloc_set_pte(vmf, page))
> -                       goto unlock;
> +               if (pte_none(*vmf->pte))
> +                       do_set_pte(vmf, page);
> +               /* no need to invalidate: a not-present page won't be cached */
> +               update_mmu_cache(vma, vmf->address, vmf->pte);
>                 unlock_page(head);
> -               goto next;
> +               continue;

This can't be right.

Look at what happens if "pte_none()" is not true.. It won't install
the new pte, but it also won't drop the ref to the page.

So I think it needs to be

-               if (alloc_set_pte(vmf, page))
+               if (!pte_none(*vmf->pte))
                        goto unlock;
+               do_set_pte(vmf, page);

instead, so that the "if somebody else already filled the page table"
case gets handled right.

Hmm?

              Linus




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux