[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210801124917.ca6fce3972866dc738bfcb7b@linux-foundation.org>
Date: Sun, 1 Aug 2021 12:49:17 -0700
From: Andrew Morton <akpm@...ux-foundation.org>
To: Mina Almasry <almasrymina@...gle.com>
Cc: Ken Chen <kenchen@...gle.com>,
Mike Kravetz <mike.kravetz@...cle.com>, linux-mm@...ck.org,
linux-kernel@...r.kernel.org, Chris Kennelly <ckennelly@...gle.com>
Subject: Re: [PATCH v1] mm, hugepages: add mremap() support for hugepage
backed vma
On Fri, 30 Jul 2021 15:15:22 -0700 Mina Almasry <almasrymina@...gle.com> wrote:
> Support mremap() for hugepage backed vma segment by simply repositioning
> page table entries. The page table entries are repositioned to the new
> virtual address on mremap().
>
> Hugetlb mremap() support is of course generic; my motivating use case
> is a library (hugepage_text), which reloads the ELF text of executables
> in hugepages. This significantly increases the execution performance of
> said executables.
>
> Restricts the mremap operation on hugepages to up to the size of the
> original mapping as the underlying hugetlb reservation is not yet
> capable of handling remapping to a larger size.
>
> Tested with a simple mmap/mremap test case, roughly:
>
> void* haddr = mmap(NULL, size, PROT_READ | PROT_WRITE | PROT_EXEC,
> MAP_ANONYMOUS | MAP_SHARED, -1, 0);
>
> void* taddr = mmap(NULL, size, PROT_NONE,
> MAP_HUGETLB | MAP_ANONYMOUS | MAP_SHARED, -1, 0);
>
> void* raddr = mremap(haddr, size, size, MREMAP_MAYMOVE | MREMAP_FIXED, taddr);
Could we please get testing for this added into tools/testing/selftests/?
Powered by blists - more mailing lists