[PATCH] mm: introduce reference pages

Kirill A. Shutemov kirill at shutemov.name
Tue Aug 4 11:48:04 EDT 2020


On Tue, Aug 04, 2020 at 04:27:50PM +0100, Catalin Marinas wrote:
> On Mon, Aug 03, 2020 at 05:50:32PM -0700, Peter Collingbourne wrote:
> > On Mon, Aug 3, 2020 at 5:01 AM Catalin Marinas <catalin.marinas at arm.com> wrote:
> > > I think this would work even for the arm64 MTE (though I haven't tried):
> > > use memfd_create() to get such file descriptor, mmap() it as MAP_SHARED
> > > to populate the initial pattern, mmap() it as MAP_PRIVATE for any
> > > subsequent mapping that needs to be copied-on-write.
> > 
> > That would require a separate mmap() (i.e. separate VMA) for each
> > page, no? That sounds like it could be expensive both in terms of VMAs
> > and the number of mmap syscalls required (i.e. N/PAGE_SIZE). You could
> > decrease these costs by increasing the size of the memfd files to more
> > than a page, but that would also increase the amount of memory
> > required for the reference pages.
> 
> I think I get it now. You'd like a multiple page mmap() to be covered by
> a single reference page. The memfd trick wouldn't give you this without
> multiple mmap() calls, one for each page.

That's why I suggested a special file descriptor that would give the same
page on any access. We can piggy back on memfd infrastrucure or create a
new interface.

-- 
 Kirill A. Shutemov



More information about the linux-arm-kernel mailing list