Re: RFC for new feature to move pages from one vma to another without split

From: Suren Baghdasaryan
Date: Tue Jun 06 2023 - 19:20:16 EST


On Tue, Jun 6, 2023 at 1:15 PM Vlastimil Babka <vbabka@xxxxxxx> wrote:
>
> On 4/13/23 17:36, Peter Xu wrote:
> > On Thu, Apr 13, 2023 at 10:10:44AM +0200, David Hildenbrand wrote:
> >> So instead, we consider the whole address space as a virtual, anon file,
> >> starting at offset 0. The pgoff of a VMA is then simply the offset in that
> >> virtual file (easily computed from the start of the VMA), and VMA merging is
> >> just the same as for an ordinary file.
> >
> > Interesting point, thanks!
>
> FYI, I've advised a master thesis exploring how to update page->index during
> mremap() to keep things mergeable:
>
> https://dspace.cuni.cz/bitstream/handle/20.500.11956/176288/120426800.pdf
>
> I think the last RFC posting was:
> https://lore.kernel.org/all/20220516125405.1675-1-matenajakub@xxxxxxxxx/
>
> It was really tricky for the general case. Maybe it would be more feasible
> for the limited case Lokesh describes, if we could be sure the pages that
> are moved aren't mapped anywhere else.

Lokesh asked me to pick up this work and prepare patches for
upstreaming. I'll start working on them after I finish with per-vma
lock support for swap and userfaultd (targeting later this week).
Thanks for all the input folks!