Re: [PATCH 1/3] mm: change huge_ptep_clear_flush() to return the original pte

Mike Kravetz
2022-05-05T23:15:26Z

On 4/29/22 01:14, Baolin Wang wrote:
> It is incorrect to use ptep_clear_flush() to nuke a hugetlb page
> table when unmapping or migrating a hugetlb page, and will change
> to use huge_ptep_clear_flush() instead in the following patches.
>
> So this is a preparation patch, which changes the huge_ptep_clear_flush()
> to return the original pte to help to nuke a hugetlb page table.
>
> Signed-off-by: Baolin Wang <baolin.wang@linux.alibaba.com>
> ---
> arch/arm64/include/asm/hugetlb.h | 4 ++--
> arch/arm64/mm/hugetlbpage.c | 12 +++++-------
> arch/ia64/include/asm/hugetlb.h | 4 ++--
> arch/mips/include/asm/hugetlb.h | 9 ++++++---
> arch/parisc/include/asm/hugetlb.h | 4 ++--
> arch/powerpc/include/asm/hugetlb.h | 9 ++++++---
> arch/s390/include/asm/hugetlb.h | 6 +++---
> arch/sh/include/asm/hugetlb.h | 4 ++--
> arch/sparc/include/asm/hugetlb.h | 4 ++--
> include/asm-generic/hugetlb.h | 4 ++--
> 10 files changed, 32 insertions(+), 28 deletions(-)

The above changes look straight forward.
Happy that you Cc'ed impacted arch maintainers so they can at least
have a look.

The only user of huge_ptep_clear_flush() today is hugetlb_cow/wp() in
mm/hugetlb.c. Any reason why you did not change that code? At least
cast the return of huge_ptep_clear_flush() to void with a comment?
Not absolutely necessary.

Acked-by: Mike Kravetz <mike.kravetz@oracle.com>
--
Mike Kravetz