Re: [PATCH] mm/khugepaged: skip shmem with armed userfaultfd

From: Yang Shi
Date: Thu Feb 02 2023 - 16:11:38 EST


On Thu, Feb 2, 2023 at 12:04 PM Peter Xu <peterx@xxxxxxxxxx> wrote:
>
> On Wed, Feb 01, 2023 at 03:57:33PM -0800, Yang Shi wrote:
> > > There's another problem where the current vma may not have uffd armed,
> > > khugepaged may think it has nothing to do with uffd and moved on with
> > > collapsing, but actually it's armed in another vma of either the current mm
> > > or just another mm's.
> >
> > Out of curiosity, could you please elaborate how another vma armed
> > with userfaultfd could have an impact on the vmas that are not armed?
>
> It's e.g. when >1 vmas mapped to the same shmem file on the same range, one
> registered with uffd missing, others not. Then others can cause page cache
> populated without generating message to the vma that got uffd missing mode
> registered, so there'll be the same issue as when khugepaged accidentally
> does thp collapsings. Thanks,

Got it, thank you.

>
> --
> Peter Xu
>