Re: [PATCH v11 0/7] Implement IOCTL to get and optionally clear info about PTEs

Mike Rapoport
2023-03-21T12:43:29Z

On Mon, Mar 20, 2023 at 11:30:00AM -0700, Andrei Vagin wrote:
> On Thu, Mar 9, 2023 at 11:58 AM Andrew Morton <akpm@linux-foundation.org> wrote:
> >
> > On Thu, 9 Mar 2023 18:57:11 +0500 Muhammad Usama Anjum <usama.anjum@collabora.com> wrote:
> >
> > > The information related to pages if the page is file mapped, present and
> > > swapped is required for the CRIU project [5][6]. The addition of the
> > > required mask, any mask, excluded mask and return masks are also required
> > > for the CRIU project [5].
> >
> > It's a ton of new code and what I'm not seeing in here (might have
> > missed it?) is a clear statement of the value of this feature to our
> > users.
> >
> > I see hints that CRIU would like it, but no description of how valuable
> > this is to CRIU's users.
>
> Hi Andrew,
>
> The current interface works for CRIU, and I can't say we have anything
> critical with it right now.
>
> On the other hand, the new interface has a number of significant improvements:
>
> * it is more granular and allows us to track changed pages more
> effectively. The current interface can clear dirty bits for the entire
> process only. In addition, reading info about pages is a separate
> operation. It means we must freeze the process to read information
> about all its pages, reset dirty bits, only then we can start dumping
> pages. The information about pages becomes more and more outdated,
> while we are processing pages. The new interface solves both these
> downsides. First, it allows us to read pte bits and clear the
> soft-dirty bit atomically. It means that CRIU will not need to freeze
> processes to pre-dump their memory. Second, it clears soft-dirty bits
> for a specified region of memory. It means CRIU will have actual info
> about pages to the moment of dumping them.
>
> * The new interface has to be much faster because basic page filtering
> is happening in the kernel. With the old interface, we have to read
> pagemap for each page.

There is still a caveat in using userfaultfd for tracking dirty pages in
CRIU because we still don't support C/R of processes that use uffd.

> Thanks,
> Andrei
>
> >
> > So please spend some time preparing this info.
> >
> > Also, are any other applications of this feature anticipated? If so,
> > what are they?
> >
> > IOW, please sell this stuff to us!

--
Sincerely yours,
Mike.