[PATCH v2 11/13] mm/gup: Handle huge pmd for follow_pmd_mask()

Jason Gunthorpe jgg at nvidia.com
Tue Jan 16 05:51:07 AEDT 2024


On Wed, Jan 03, 2024 at 05:14:21PM +0800, peterx at redhat.com wrote:
> From: Peter Xu <peterx at redhat.com>
> 
> Replace pmd_trans_huge() with pmd_thp_or_huge() to also cover pmd_huge() as
> long as enabled.
> 
> FOLL_TOUCH and FOLL_SPLIT_PMD only apply to THP, not yet huge.
> 
> Since now follow_trans_huge_pmd() can process hugetlb pages, renaming it
> into follow_huge_pmd() to match what it does.  Move it into gup.c so not
> depend on CONFIG_THP.
> 
> When at it, move the ctx->page_mask setup into follow_huge_pmd(), only set
> it when the page is valid.  It was not a bug to set it before even if GUP
> failed (page==NULL), because follow_page_mask() callers always ignores
> page_mask if so.  But doing so makes the code cleaner.
> 
> Signed-off-by: Peter Xu <peterx at redhat.com>
> ---
>  mm/gup.c         | 107 ++++++++++++++++++++++++++++++++++++++++++++---
>  mm/huge_memory.c |  86 +------------------------------------
>  mm/internal.h    |   5 +--
>  3 files changed, 105 insertions(+), 93 deletions(-)

Reviewed-by: Jason Gunthorpe <jgg at nvidia.com>

Jason


More information about the Linuxppc-dev mailing list