[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHS8izM6p-bbhh+gDJmRfVRk2bWjtDr6Rfpm-rjA_t-i=GBYOQ@mail.gmail.com>
Date: Sun, 1 Aug 2021 16:12:39 -0700
From: Mina Almasry <almasrymina@...gle.com>
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: Ken Chen <kenchen@...gle.com>,
Mike Kravetz <mike.kravetz@...cle.com>,
Linux-MM <linux-mm@...ck.org>,
open list <linux-kernel@...r.kernel.org>,
Chris Kennelly <ckennelly@...gle.com>
Subject: Re: [PATCH v1] mm, hugepages: add mremap() support for hugepage
backed vma
On Sun, Aug 1, 2021, 12:49 PM Andrew Morton <akpm@...ux-foundation.org> wrote:
>
> 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/?
Yep sure thing. I'll wait some time to see if there are any other
review comments and then send v2 with tests.
Powered by blists - more mailing lists