[PATCH] mm: introduce reference pages

Catalin Marinas catalin.marinas at arm.com
Tue Aug 4 11:27:50 EDT 2020


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.

-- 
Catalin



More information about the linux-arm-kernel mailing list