Re: [RFC PATCH v2 25/47] hugetlb: add HGM support for copy_hugetlb_page_range
From: James Houghton
Date: Wed Nov 30 2022 - 18:29:20 EST
On Wed, Nov 30, 2022 at 4:32 PM Peter Xu <peterx@xxxxxxxxxx> wrote:
>
> On Fri, Oct 21, 2022 at 04:36:41PM +0000, James Houghton wrote:
> > This allows fork() to work with high-granularity mappings. The page
> > table structure is copied such that partially mapped regions will remain
> > partially mapped in the same way for the new process.
> >
> > A page's reference count is incremented for *each* portion of it that is
> > mapped in the page table. For example, if you have a PMD-mapped 1G page,
> > the reference count and mapcount will be incremented by 512.
> >
> > Signed-off-by: James Houghton <jthoughton@xxxxxxxxxx>
>
> I have a feeling that this path is not triggered. See:
>
> bcd51a3c679d ("hugetlb: lazy page table copies in fork()", 2022-07-17)
>
> It might be helpful to have it when exploring private mapping support of
> hgm on page poison in the future. But the thing is if we want this to be
> accepted we still need a way to test it. I just don't see how to test this
> without the private support being there..
We can trigger this behavior by registering the VMA with
uffd-writeprotect. I didn't include any self-tests for this though;
I'll make sure to actually test this path in v1.
- James
>
> --
> Peter Xu
>