Re: [PATCH v11 14/22] mm: pagewalk: Add 'depth' parameter to pte_hole

From: Jason Gunthorpe
Date: Mon Oct 07 2019 - 12:10:54 EST


On Mon, Oct 07, 2019 at 04:38:14PM +0100, Steven Price wrote:
> diff --git a/mm/hmm.c b/mm/hmm.c
> index 902f5fa6bf93..34fe904dd417 100644
> +++ b/mm/hmm.c
> @@ -376,7 +376,7 @@ static void hmm_range_need_fault(const struct hmm_vma_walk *hmm_vma_walk,
> }
>
> static int hmm_vma_walk_hole(unsigned long addr, unsigned long end,
> - struct mm_walk *walk)
> + __always_unused int depth, struct mm_walk *walk)

It this __always_unused on function arguments something we are doing
now?

Can we have negative depth? Should it be unsigned?

> {
> struct hmm_vma_walk *hmm_vma_walk = walk->private;
> struct hmm_range *range = hmm_vma_walk->range;
> @@ -564,7 +564,7 @@ static int hmm_vma_walk_pmd(pmd_t *pmdp,
> again:
> pmd = READ_ONCE(*pmdp);
> if (pmd_none(pmd))
> - return hmm_vma_walk_hole(start, end, walk);
> + return hmm_vma_walk_hole(start, end, 0, walk);
>
> if (thp_migration_supported() && is_pmd_migration_entry(pmd)) {
> bool fault, write_fault;
> @@ -666,7 +666,7 @@ static int hmm_vma_walk_pud(pud_t *pudp, unsigned long start, unsigned long end,
> again:
> pud = READ_ONCE(*pudp);
> if (pud_none(pud))
> - return hmm_vma_walk_hole(start, end, walk);
> + return hmm_vma_walk_hole(start, end, 0, walk);
>
> if (pud_huge(pud) && pud_devmap(pud)) {
> unsigned long i, npages, pfn;
> @@ -674,7 +674,7 @@ static int hmm_vma_walk_pud(pud_t *pudp, unsigned long start, unsigned long end,
> bool fault, write_fault;
>
> if (!pud_present(pud))
> - return hmm_vma_walk_hole(start, end, walk);
> + return hmm_vma_walk_hole(start, end, 0, walk);
>
> i = (addr - range->start) >> PAGE_SHIFT;
> npages = (end - addr) >> PAGE_SHIFT;

Otherwise this mechanical change to hmm.c looks OK to me

Jason