Re: [PATCH] mm: introduce reference pages
From: Kirill A. Shutemov <hidden>
Date: 2020-08-04 15:48:04
Also in:
linux-mm
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:quoted
On Mon, Aug 3, 2020 at 5:01 AM Catalin Marinas [off-list ref] wrote:quoted
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 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel