Re: [RFC PATCH v2 16/47] hugetlb: make unmapping compatible with high-granularity mappings

From: Mike Kravetz
Date: Wed Dec 14 2022 - 19:29:50 EST


On 10/21/22 16:36, James Houghton wrote:
> Enlighten __unmap_hugepage_range to deal with high-granularity mappings.
> This doesn't change its API; it still must be called with hugepage
> alignment, but it will correctly unmap hugepages that have been mapped
> at high granularity.
>
> The rules for mapcount and refcount here are:
> 1. Refcount and mapcount are tracked on the head page.
> 2. Each page table mapping into some of an hpage will increase that
> hpage's mapcount and refcount by 1.
>
> Eventually, functionality here can be expanded to allow users to call
> MADV_DONTNEED on PAGE_SIZE-aligned sections of a hugepage, but that is
> not done here.
>
> Signed-off-by: James Houghton <jthoughton@xxxxxxxxxx>
> ---
> include/asm-generic/tlb.h | 6 ++--
> mm/hugetlb.c | 76 +++++++++++++++++++++++++--------------
> 2 files changed, 52 insertions(+), 30 deletions(-)

All looks reasonable, nothing stands out.

--
Mike Kravetz