Re: [PATCH 1/2] hugetlbfs: extend hugetlb_vma_lock to private VMAs

From: Rik van Riel
Date: Thu Sep 21 2023 - 20:37:31 EST


On Thu, 2023-09-21 at 15:42 -0700, Mike Kravetz wrote:
> On 09/19/23 22:16, riel@xxxxxxxxxxx wrote:
> > From: Rik van Riel <riel@xxxxxxxxxxx>
> >
> > Extend the locking scheme used to protect shared hugetlb mappings
> > from truncate vs page fault races, in order to protect private
> > hugetlb mappings (with resv_map) against MADV_DONTNEED.
> >
> > Add a read-write semaphore to the resv_map data structure, and
> > use that from the hugetlb_vma_(un)lock_* functions, in preparation
> > for closing the race between MADV_DONTNEED and page faults.
> >
> > Signed-off-by: Rik van Riel <riel@xxxxxxxxxxx>
> > ---
> >  include/linux/hugetlb.h |  6 ++++++
> >  mm/hugetlb.c            | 36 ++++++++++++++++++++++++++++++++----
> >  2 files changed, 38 insertions(+), 4 deletions(-)
>
> This looks straight forward.
>
> However, I ran just this patch through libhugetlbfs test suite and it
> hung on
> misaligned_offset (2M: 32).
> https://github.com/libhugetlbfs/libhugetlbfs/blob/master/tests/misaligned_offset.c

Ah, so that's why I couldn't find hugetlbfs tests in the kernel
selftests directory. They're in libhugetlbfs.

I'll play around with those tests tomorrow. Let me see what's
going on.

--
All Rights Reversed.