[RFC PATCH 2/2] mm/mremap: Fix race between MOVE_PUD mremap and pageout

Linus Torvalds torvalds at linux-foundation.org
Wed May 26 03:28:39 AEST 2021

On Mon, May 24, 2021 at 10:34 PM Aneesh Kumar K.V
<aneesh.kumar at linux.ibm.com> wrote:
> @@ -221,6 +222,9 @@ static inline void page_vma_mapped_walk_done(struct page_vma_mapped_walk *pvmw)
>                 spin_unlock(pvmw->pte_ptl);
>         if (pvmw->pmd_ptl)
>                 spin_unlock(pvmw->pmd_ptl);
> +       if (pvmw->pud_ptl)
> +               spin_unlock(pvmw->pud_ptl);
> +
>  }

You have this habit of adding odd whitespace..

But yes, this seems to be the right way to fix the races properly. The
pageout code is special, the pageout code is normally not critical, so
it's the pageout code that should go the extra mile to make up for the
fact that it doesn't hold the mmap_sem like good page table
modification codepaths do.


More information about the Linuxppc-dev mailing list